URL重寫以完全刪除變量

[英]URL Rewrite to remove variable entirely


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

我需要從NetSuite修復一堆URL以進入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)

NetSuite從類別中生成這些URL(即sc = 99&category = 6666666是什么用途)

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

我想從網址中完全刪除變量。

Any suggestions?

1 个解决方案

#1


1  

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

所以,再一次,我沒有得到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.

從我的網址中刪除查詢字符串,它會查找“sc =”和最少1位或最多2位數字和“&category =”以及最少1位或最多7位數。

Credit belongs to 'penders' @webmasterworld.com.

Credit屬於'penders'@ webmasterworld.com。

Thanks again.


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2014/08/17/72a039fe67398230c193bedbc9de3c5a.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com