remove underscore fom URL
7 posts
• Page 1 of 1
remove underscore fom URL
Hello,
I need a rule that will do the following.
this URL:
http://mysite.com/product.aspx?product_id=123
to be rewritten as:
http://mysite.com/product.aspx?productid=123
Thank You!
I need a rule that will do the following.
this URL:
http://mysite.com/product.aspx?product_id=123
to be rewritten as:
http://mysite.com/product.aspx?productid=123
Thank You!
Re: remove underscore fom URL
Hello,
Please try the following rule:
RewriteBase /
RewriteCond %{QUERY_STRING} ^product_id=(\d+)$ [NC]
RewriteRule ^product\.aspx$ /product.aspx/productid=%1 [NC,L]
Please try the following rule:
RewriteBase /
RewriteCond %{QUERY_STRING} ^product_id=(\d+)$ [NC]
RewriteRule ^product\.aspx$ /product.aspx/productid=%1 [NC,L]
Re: remove underscore fom URL
Hi Anton,
I think it just needs some modifications but you are on the right track. Here is what the webserver is seeing when browsing to :
http://mysite.com/product.aspx?product_id=123
It comes through as
http://mysite.com/product.aspx/productid=123 product_id=123
I think it just needs some modifications but you are on the right track. Here is what the webserver is seeing when browsing to :
http://mysite.com/product.aspx?product_id=123
It comes through as
http://mysite.com/product.aspx/productid=123 product_id=123
Re: remove underscore fom URL
Hello,
Please try to fix the rules like this:
RewriteBase /
RewriteCond %{QUERY_STRING} ^product_id=(\d+)$ [NC]
RewriteRule ^product\.aspx$ /product.aspx?productid=%1 [NC,L,QSA]
Please try to fix the rules like this:
RewriteBase /
RewriteCond %{QUERY_STRING} ^product_id=(\d+)$ [NC]
RewriteRule ^product\.aspx$ /product.aspx?productid=%1 [NC,L,QSA]
Re: remove underscore fom URL
I think it is really close now, here is what the webserver is seeing:
/product.aspx productid=123&product_id=123
It looks like it is appending the &product_id=123 is there a way to fix this?
/product.aspx productid=123&product_id=123
It looks like it is appending the &product_id=123 is there a way to fix this?
Re: remove underscore fom URL
Hello,
Here's the config that should work as expected:
RewriteBase /
RewriteCond %{QUERY_STRING} ^product_id=(\d+)$ [NC]
RewriteRule ^product\.aspx$ /product.aspx?productid=%1 [NC,L]
Here's the config that should work as expected:
RewriteBase /
RewriteCond %{QUERY_STRING} ^product_id=(\d+)$ [NC]
RewriteRule ^product\.aspx$ /product.aspx?productid=%1 [NC,L]
Re: remove underscore fom URL
Thanks Anton,
You are a genius. The only thing that I had to change was adding R=301 so
RewriteRule ^product\.aspx$ /product.aspx?productid=%1 [NC,L,R=301]
You are a genius. The only thing that I had to change was adding R=301 so
RewriteRule ^product\.aspx$ /product.aspx?productid=%1 [NC,L,R=301]
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 18 guests