regex - Catchall rewrite rule after 1:1 301 redirect stops 1:1 redirect from working -
i implementing 1:1 redirect in htaccess this:
redirect 301 /1.html site.com/folder/1 redirect 301 /2.html site.com/2 redirect 301 /3 site.com/vw-vans/another-folder/2 redirect 301 /3.html site.com/3 rewritecond %{request_uri} .*\.(html) rewriterule ^(.+\.html)$ site.com/folder? [r=301]
what expecting here if 1.html matches redirected site.com/folder/1 , not site.com/folder. unless remove rewrite rule, happening. 'l' flag.
is not possible or doing wrong if want 1:1 redirect work , if url not part of 1:1 redirects, apply rewrite condition. don't think there [l] flag 'redirect' method.
don't mix mod_alias
rules , mod_rewrite
1 both invoked @ different times apache.
try in .htaccess:
rewriteengine on rewriterule ^1\.html$ /folder/1 [r=301,l,nc] rewriterule ^2\.html$ /2 [r=301,l,nc] rewriterule ^3\.html$ /3 [r=301,l,nc] rewriterule ^3/?$ /vw-vans/another-folder/2 [r=301,l,nc] # catchall rule .html files rewriterule ^.+?\.html$ /folder? [r=301,l,nc]
make sure clear browser cache before testing this.
Comments
Post a Comment