为旧xtcommerce 3.04 sp 2.1 shopsystem生成搜索引擎友好URL的nginx重写规则

为旧xtcommerce 3.04 sp 2.1 shopsystem生成搜索引擎友好URL的nginx重写规则,nginx,url-rewriting,oscommerce,Nginx,Url Rewriting,Oscommerce,在将旧的shopsystem从apache迁移到nginx时,我需要一些帮助。 在apache中,不需要做任何事情。我猜shopsystem在某种程度上进行了优化以处理这些URL。我没有任何修改规则做一些魔术。然而,我需要做的是以某种模式重写URL 期望的行为: Replace 1st / after Filename ending with (.php) with ? Replace 2nd / with = Replace 3rd / with & Replace 4th / wit

在将旧的shopsystem从apache迁移到nginx时,我需要一些帮助。 在apache中,不需要做任何事情。我猜shopsystem在某种程度上进行了优化以处理这些URL。我没有任何修改规则做一些魔术。然而,我需要做的是以某种模式重写URL

期望的行为:

Replace 1st / after Filename ending with (.php) with ?
Replace 2nd / with =
Replace 3rd / with &
Replace 4th / with =
[repeat 3/4] as long as there are parameters inside the URL
示例URL:

http://www.shop.de/login.php/action/process
should rewrite to => http://www.shop.de/login.php?action=process

我想保持URL的原样,只是做一些内部重写


感谢您的任何帮助

http://www.shop.de/login.php/action/process
应重写为
http://www.shop.de/login.php?action=process

location / {
  rewrite ^/login.php/action/(.*)$ /login.php?action=$2$query_string;
}

对于我的产品,我有这样的重写:

RewriteRule ^shop(\d+|)/([\w_-]*)_([0-9]+)\.html$ shop$1/product_info.php?products_name=$2&products_id=$3 [L,QSA]
url看起来像

/shop/motorezina-metzeler-feelfree-wintec-110-70r13-r13-110-70-48p-tl-perednyaya-front_3571287.html

示例URL仅为
login.php
,但这并不意味着这将是唯一的URL。你的例子在其他情况下不起作用。
/shop/motorezina-metzeler-feelfree-wintec-110-70r13-r13-110-70-48p-tl-perednyaya-front_3571287.html