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.
我想将非 www 重定向到 www,并排除特定文件(例如 testit.php)。找不到有效的解决方案...
RewriteCond %{REQUEST_URI} !^testit.php RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
这会重定向所有文件,包括 testit.php(我想排除)。
感谢帮助!
RewriteCond %{REQUEST_URI} !^/testit.php RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]