Forum Moderators: phranque
The original URL that we want to redirect is structured
http://www.example.com/Repair_Service/Repair.php?TOWN=Island_Park
We put in the HTACCESS FILE:
redirect 301 /Computer_Services/PC_Repair.php http://www.example.com/New_York/Long_Island/Repair_Service/New_York_Repair.html
HOWEVER IT LEADS ME TO THE:
http://www.example.com/New_York/Long_Island/Repair_Service/New_York_Repair.html?TOWN=Island_Park
The Ideal redirect would have the link READ:
http://www.example.com/New_York/Long_Island/Repair_Service/Island_Park_Repair.html
How can one go about doing this?
[edited by: jdMorgan at 4:34 pm (utc) on Oct. 21, 2009]
[edit reason] example.com [/edit]
In mod_rewrite, you must use a RewriteCond to examine/test the query string, if you only want to redirect based on a specific URL+query value. From your mod_alias code above, it appears that you may wish to redirect without regard to the requested query string, so this may not be necessary.
Jim
RewriteRule ^New_York/Long_Island/Repair_Service/([^/]*)_Repair.html$ [domain.com...] [R=301,L,QSA]
It is not redirecting.
RewriteRule ^New_York/Long_Island/Repair_Service/([^/]*)_Repair.html$ [domain.com...] [R=301,L,QSA]
It is not redirecting.
So your URL-path-pattern should probably start with "^Computer_Services/" as it did in your original code.
Please do not change the URLs cited here unless the originals were wrong. We need good example URLs, and we need to know where your code is located. If either change, then the code must change.
From the description of your goal, you certainly do not want to use the "QSA" flag...
Also, if you do not have other working rewriterules, you'll need one or two more directives to set up and enable mod_rewrite.
Jim