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.
仅当urlstyle=2不包含style=2.
style=2
在目录根目录中,我有一个 .htaccess,其中包含以下内容:
RewriteCond %{QUERY_STRING} !(?style=|&style=) RewriteRule ^(.*)$ %1&style=2? [R=301,QSA]
我知道这是错的。任何人都可以帮忙吗?
将您的代码更改为此以使其工作:
RewriteCond %{QUERY_STRING} !(^|&)style=2(&|$) [NC] RewriteRule ^ %{REQUEST_URI}?style=2 [R=301,L,QSA]
试试这个 :
RewriteCond %{QUERY_STRING} !^(.*&)?style= RewriteRule ^(.*)$ /$1?style=2 [L,QSA,R=301]