Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想像这样设置我的 htaccess:
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+) index.php?slash1=$1&slash2=$2&slash3=$3&slash4=$4 [NC]
但保留某些不应受上述影响的目录,例如 domain.com/banana 应该只是 domain.com/banana 而不是 index.php 与 slash1=banana。
只需像这样添加 RewriteCond :
RewriteCond %{REQUEST_URI} !^/(banana|oranges|apple)(/.*|)$ [NC] RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+) index.php?slash1=$1&slash2=$2&slash3=$3&slash4=$4 [NC,L]