Hi, I want to rewrite a URL from one of may pages, but also want to redirect all traffic from the old URL to the new change one, example: Old URL : www.mysite.com/results.php?category=5 New URL : www.mysite.com/alpaca-rugs For this to work, I have place the following code in my. htaccess page : RewriteRule ^alpaca\-rugs$ results.php?category=5 which works fine by it self , but since I know that only the old URl appears on the SERPs I have to redirect all traffic going to the old URL to the new one, so for this second task, I have added the following code: RewriteCond %{QUERY_STRING} ^category=5$ RewriteRule ^results.php$ /alpaca-rugs But it does not redirect properly. I'm not an expert on this subject so please can someone help fix this problem. Thanx
try this: RewriteCond %{QUERY_STRING} ^category=5$ RewriteRule ^results.php /alpaca\-rugs [L, R=301] this needs to be above your other lines in htaccess. Let me know if it works.
Hi, thanks for the reply, ok, I tried both but it does not redirect properly and I get the following URL on the browser address bar: http://www.mysite.com/alpaca-rugs?category=5 I also tried : RewriteCond %{QUERY_STRING} ^category=5$ RewriteRule ^results.php$ /alpaca-rugs? [L,R=301] RewriteRule ^alpaca\-rugs$ results.php?category=5 It does not redirect properly either but I get http://www.mysite.com/alpaca-rugs on the browser address bar , any more suggestions? Thanks
Try this code aswell as the code that is currently working RewriteRule ^alpaca\-rugs$ results.php?category=5 [R=301] But, even if you do get it going, I think its a given that you will suffer temporary PageRank drop anyway, regardless of whether you redirect as well. But don't panic, it should return to normal eventually.
You do realize that no matter how you do this you will potentially change your PR or search rankings right? Just something to consider before you do anything crazy.
I agree with websecrets. You should be careful before you permanently change your url. Unfortunately I dont have an answer and Im not too sure how fast someone from google would help you transition your pages without losing your search rankings. Have you tried searching httpdot//wwwdotapacheforumdotcom. Im sure this has come up before.