wild card redirects issue giving error this webpage has a redirect loop

Posted by david on Server Fault See other posts from Server Fault or by david
Published on 2012-09-06T09:50:06Z Indexed on 2012/09/06 21:41 UTC
Read the original article Hit count: 235

Filed under:
|

In my website I changed or better word modified the directory name ""vehicles-cars"" to ""vehicles-cars-for-sale"" when i tried to redirect using wild card redirect my old directory name to new directory name in my web hosting cpanel account. every time when i open pages from that directory i am getting error code.

This web-page has a redirect loop.

The website is php.

The problem is that that my lots of pages from old directory are indexed in googles and they are getting duplicate contents.

If I redirect single page it works perfect but there are lots of pages so I need wild card redirect to redirect whole directory .

I really need some advice what to do with this problem.

Here is .htaccess file code for redirect thanks

RewriteEngine on

RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$

RewriteRule ^vehicles\-cars\/?(.*)$ "http\:\/\/example\.com\/vehicles\-cars\-for\-sale\/$1" [R=301,L]

i have other wilcard redirect of whole directory with same code and its working perfect here is the code in .htaccss file which is same as above and working perfect for this directory

RewriteCond %{HTTP_HOST} ^adsbuz\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.adsbuz\.com$
RewriteRule ^autos\/?(.*)$ "http\:\/\/adsbuz\.com\/vehicles\-cars\-for\-sale\/$1" [R=301,L]

so i dont understand whats wrong with the above code please i really need some expert advice thanks again

© Server Fault or respective owner

Related posts about php

Related posts about .htaccess