Home › Forums › Newbie Helpdesk › Redirect rules on adult sites
- This topic is empty.
-
AuthorPosts
-
jeremyb
GuestHey, another tech question…
After removing a really crappy “amp” plugin on my adult site, we need to redirect all url’s ending with /amp/ to the original (which now naturally delivers an amp version to mobile users).
I’m guessing there’s a redirect method to do this rather than performing a thousand 301’s?
Does anyone know what the format for that redirect would be? I don’t even know the terminology I would need to search under to find the solution to this.
Many thanks, as always.
DOC
GuestWell yes.. it gets a bit complicated:
askapache.com/htaccess/m…e-tips-tricks/
It would involve adding rules to htaccess file. I wonder if you are not just better off finding a plugin that handles this.
Marv
GuestTry this code in your .htaccess file. Insert it after RewriteEngine On.
RewriteCond %{REQUEST_URI} ^/amp/(.*)$
RewriteRule ^(.*) yoursite.com/%1 [R=301,NC]jeremyb
GuestThanks guys, I think that rewrite rule worked but I’ll monitor it for a few days and see what happens. It looks right to me but these things always make me nervous.
Mykel
GuestDoesn’t that redirect everything that starts with /amp/ rather than ends with /amp/?
Marv
GuestYou’re right. But I’ve tried that redirection and it works for me, so I gave Conran that code.
Of course, he could always try with RedirectMatch 301 ^/(.+)amp$ /$1 but I’m not sure about the result.
I guess you have a better idea.Mykel
GuestThe line should be…
RewriteCond %{REQUEST_URI} ^(.*)/amp/$
I can’t see how it would work at all if you did it the other way. No pages would get redirected because none of them start with /amp/ – they only end with /amp/
-
AuthorPosts