1

From yesterday, I'm trying this 301 url redirect but its not working as expected. Please help me with this. here is the .htaccess file code.

Options +FollowSymLinks +SymLinksIfOwnerMatch -MultiViews
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301]
RewriteBase /
rewriterule ^(.*)/(.*)\.html$ product.php?id=$1&name=$2 [L]
rewriterule ^deals/(.*)$ details.php?id=$1 [L]
rewritecond %{SERVER_PORT} 80
rewritecond %{REQUEST_URI} publisher.php

Redirect 301 /deals/74/product-name.html http://mydomain.com/74/product-name.html

Whenever I enter www.mydomain.com/deals/74/product-name.html, It redirects me to "www.mydomain.com/deals/74/product-name.html?id=74&name=product-name"

I'm not sure why its appending "?id=74&name=product-name" after url? I want to display only "www.mydomain.com/deals/74/product-name.html"

I don't know how to fix this problem. I'll appreciate if you can guide me on this.

1 Answer 1

1

Well... Append "?id=74&name=product-name" is what the line 6 of your code does:

rewriterule ^(.*)/(.*)\.html$ product.php?id=$1&name=$2 [L]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.