apache - Simple .htaccess won't rewrite and seems not to match at all -


it should straight forward. http://example.com/denver-cars/ not redirect http://example.com/newcars-in-denver/. tries load /denver-cars/ , denver-cars in url. missing here? have tried moving , down list of rules , have tried numerous types of flags no avail. shed light on 3 hr problem takes 10sec fix?

options +followsymlinks rewriteengine on rewritebase /  # force www rewritecond %{http_host} ^site.com [nc] rewriterule ^(.*)$ http://www.example.com/$1 [l,r=301,nc]  # redirect google index dir's new dir rewriterule ^/(.*)-cars/ /newcars-in-$1/  [nc,r=301,l]  # disable rewrite folder names rewritecond %{request_filename} [nc,or] rewritecond %{request_filename} [nc,or] rewritecond %{request_uri} ^awstats rewriterule .* - [l]  # permit pretty url directories rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . / [l]  ## allow image hotlinks domains rewritecond %{http_referer} !^$ rewritecond %{http_referer} !^http://(www\.)?example\.com?.*$ rewriterule .*\.jpg$      -        [f,l] 

you have leading slash in regex. urls used match rules in htaccess file has leading slash removed ^/(.*) never match anything. want:

rewriterule ^(.*)-cars/ /newcars-in-$1/  [nc,r=301,l] 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -