Reputation: 1
I am a beginner in url rewriting.
I have a url like this
http://www.sitename.com/subpages/detail.php?id=21-0043-052&car_name=abc
I want to redirect this site to
http://www.qualitextrading.com/vehicle-detail.php?id=21-0043-052&car_name=abc
Please how I can write this in .htaccess file
Upvotes: -1
Views: 44
Reputation: 15023
Assuming you have mod_rewrite
enabled:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.sitename.com$ [NC]
RewriteRule ^\/subpages\/detail\.php(*.?)$ http://www.qualitextrading.com/vehicle-detail.php$1 [R=301,L]
This turns on rewriting for this area, then checks if the HTTP_HOST is correct, then rewrites the URL and passes on the query string (default behavior of mod_rewrite
passes on query string automatically).
Upvotes: 1