简体   繁体   English

htaccess-重定向到同一位置,而不管尾部是否存在斜杠

[英]htaccess - Redirect to the same location irrespective of presence of trailing slash

I want to redirect the following sets of links: 我想重定向以下几组链接:

  1. a/b/c or a/b/c/ to a.php?b=c a / b / ca / b / c /a.php?b = c
  2. x/y1/z1/y2/z2 or x/y1/z1/y2/z2/ to x.php?y1=z1&y2=z2 x / y1 / z1 / y2 / z2x / y1 / z1 / y2 / z2 /x.php?y1 = z1&y2 = z2

using htaccess and mod rewrite in a standardized general format associating the appropriate PHP get tags and values to the corresponding SEO-friendly link. 使用htaccess和mod重写以标准化的通用格式,将适当的PHP get标签和值关联到相应的SEO友好链接。 How do I do so? 我该怎么做?

I've tried tinkering around with RewriteCond and REQUEST_FILENAME but just cannot seem to get it to work. 我尝试过修改RewriteCond和REQUEST_FILENAME,但似乎无法使其正常工作。

Something like this might help: 这样的事情可能会有所帮助:

RewriteRule ^([^/]+)/([^/]+)/([^/]+)/? /$1.php?$2=$3 [NC,L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/? /$1.php?$2=$3&$4=$5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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