#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2007
    Posts
    11
    Rep Power
    0

    Question 301 Redirect URL Appending Query String


    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.

    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.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2006
    Posts
    40
    Rep Power
    9
    Originally Posted by ajin115
    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.

    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.
    you need to remove
    rewriterule ^(.*)/(.*)\.html$ product.php?id=$1&name=$2 [L]
    rewriterule ^deals/(.*)$ details.php?id=$1 [L]

IMN logo majestic logo threadwatch logo seochat tools logo