Mailing List Archive

redirect url and banning
Hi,

I have changed an URL from:

https://www.mysite.com/word1-word2/

https://www.mysite.com/word3-word2/

and changed my .htaccess accordingly.

I have successfully banned www.mysite.com/word1-word2 without the
ending / but not with / ending using:

ban req.http.host ~ www.mysite.com/word1-word2

and

ban req.http.host ~ www.mysite.com/word1-word2/

So option without ending /, 301 redirect works but with / doesn´t.

I have googled around but I haven´t found any solution.

Regards,

Miguel

---
This email has been checked for viruses by AVG.
http://www.avg.com

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: redirect url and banning [ In reply to ]
On 02/16/18 10:21 PM, Miguel González wrote:
> Hi,
>
> I have changed an URL from:
>
> https://www.mysite.com/word1-word2/
>
> https://www.mysite.com/word3-word2/
>
> and changed my .htaccess accordingly.
>
> I have successfully banned www.mysite.com/word1-word2 without the
> ending / but not with / ending using:
>
> ban req.http.host ~ www.mysite.com/word1-word2
>
> and
>
> ban req.http.host ~ www.mysite.com/word1-word2/
>
> So option without ending /, 301 redirect works but with / doesn´t.
>
> I have googled around but I haven´t found any solution.
>
> Regards,
>
> Miguel
>


The issue was on the .htaccess redirect, I had to use:

RewriteRule ^word1\-word2/?$ "https\:\/\/www\.mysite\.com\/word3\-word2
[R=301,L]

instead of:

RewriteRule ^word1\-word2$ "https\:\/\/www\.mysite\.com\/word3\-word2
[R=301,L]


Sorry!

Miguel



---
This email has been checked for viruses by AVG.
http://www.avg.com

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: redirect url and banning [ In reply to ]
On Fri, Feb 16, 2018 at 11:21 PM, Miguel González
<miguel_3_gonzalez@yahoo.es> wrote:
> On 02/16/18 10:21 PM, Miguel González wrote:
>> Hi,
>>
>> I have changed an URL from:
>>
>> https://www.mysite.com/word1-word2/
>>
>> https://www.mysite.com/word3-word2/
>>
>> and changed my .htaccess accordingly.
>>
>> I have successfully banned www.mysite.com/word1-word2 without the
>> ending / but not with / ending using:
>>
>> ban req.http.host ~ www.mysite.com/word1-word2
>>
>> and
>>
>> ban req.http.host ~ www.mysite.com/word1-word2/
>>
>> So option without ending /, 301 redirect works but with / doesn´t.
>>
>> I have googled around but I haven´t found any solution.

None worked, it was probably a coincidence that one appeared to work.
The host header should only contain the authority, so the ban you are
looking for is rather:

ban req.http.host == www.mysite.com && req.url ~ /word1-word2/?

That should take care of both cases in a single ban.

Dridi
_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc