If you are trying to redirect a dynamic URL follow the steps to do it.
RewriteCond %{QUERY_STRING} ^product_id=(.*)$
RewriteRule ^product_view\.php$ /products/%1? [R=301,L]
The above statements would do the following,
http://www.example.com/product_view.php?product_id=4
redirected to
http://www.example.com/products/4
Hope it helps someone.
cheers.
Showing posts with label htaccess. Show all posts
Showing posts with label htaccess. Show all posts
if you are trying to redirect any subdomain request to the root, try the following method. The URL will not change in the address bar.
RewriteCond %{HTTP_HOST} ^business\.rootdomain\.com
RewriteCond %{REQUEST_URI} !^/business/
RewriteRule (.*) http://www.rootdomain.com/business/$1 [P]
if you get any internal error, add proxy & proxy http modules to Apache.
restart the web server,it should work now.
Subscribe to:
Posts (Atom)