简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM