Maxed Out
Maxed Out

Reputation: 33

URL Rewrite to remove variable entirely

I need to fix a bunch of URLs from NetSuite to move into Magento

http://www.example.com/RANDOM-PRODUCT-NAME?sc=99&category=6666666

NetSuite makes these URLs from within the category (that is what ?sc=99&category=6666666 is for)

I would like to remove the variable completely from the url.

Any suggestions?

Upvotes: 1

Views: 117

Answers (1)

Maxed Out
Maxed Out

Reputation: 33

So, once again, I get no where with stackoverflow.

On the bright side, I did get the problem solved.

RewriteEngine On
RewriteCond %{QUERY_STRING} ^sc=\d{1,2}&category=\d{1,7}$
RewriteRule ^([^.]+)$ http://www.somedomain.com/$1? [R=301,L]

that removes the query string from my URLs, it looks for the 'sc=' and a minimum of 1 or maximum of 2 digits and '&category=' and a minimum of 1 or a maximum of 7 digits.

Credit belongs to 'penders' @webmasterworld.com.

Thanks again.

Upvotes: 1

Related Questions