Answer the question
In order to leave comments, you need to log in
Regular expression for 301 redirect
In my favorite project, there was a small jamb - URLs like /abc-abc/ and /abc-abc/abc-abc-xyz/ appeared when they should be /abc/ and /abc/abc-xyz/ respectively.
Please help me to correctly compose a rewrite rule for redirecting from incorrect urls to correct ones!
My version normally works out the 1st url, but on the second one it messes up, making it out of
it
. , or like this: /{%webroot path%}/{%webroot path%}/abc/abc-xyz/ for the second
RewriteCond %{REQUEST_URI} ^(.*)abc-abc(.*)$
RewriteRule ^(.*)abc-abc(.*)$ $1abc$2 [R=301,L]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question