Reputation: 1287
My htaccess code is given below
Redirect 301 /coupon/coupon-codes-for-home-shopping-network.htm http://www.domain.com/coupon/coupon-code-for-hsn.com
Redirect 301 /coupon/coupon-code-for-shopping.hp.com http://www.domain.com/coupon/coupon-codes-for-hp-home-store.htm
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com [NC]
RewriteRule (.*) http://www.domain.com/$1 [L,R=301]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?url=$1 [L,QSA]
</IfModule>
The problem is if I navigate to http://www.domain.com/coupon/coupon-codes-for-home-shopping-network.htm it will redirect to http://www.domain.com/coupon/coupon-code-for-hsn.com?url=coupon/coupon-codes-for-home-shopping-network.htm
I need to get rid of the querystring url for these 301 redirects. Please advise. Thanks
Upvotes: 1
Views: 128
Reputation: 785128
First of all mixing mod_alias and mor_rewrite is not a good idea. Just stick to mod_rewrite since it more powerful and more flexible. Have your rules like this:
Options +FollowSymLinks -MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^coupon/coupon-codes-for-home-shopping-network\.htm$ /coupon/coupon-code-for-hsn.com [L,NC,R=301]
RewriteRule ^coupon/coupon-code-for-shopping\.hp\.com$ /coupon/coupon-codes-for-hp-home-store.htm [L,NC,R=301]
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule (.*) http://www.domain.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/coupon/
RewriteRule ^(.*)$ /index.php?url=$1 [L,QSA]
</IfModule>
Upvotes: 1