0
我試圖做基於此條件下一個htaccess重定向:的.htaccess重定向[除的index.php力WWW]
重定向沒有 「www」 的http://siteweb.com
到http://www.siteweb.com/index.html
所有頁面除http://siteweb.com/index.php
的http://siteweb.com/index.php
必須被重定向到http://www.siteweb.com/index.php
其實我用這個代碼[但蹊蹺的就可以了:S]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule !^/index.php$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/index\.php$ [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]
在此先感謝。
謝謝四你的快速回復,但對於第二種情況,我希望http://siteweb.com/index.php => http://www.siteweb.com/index.php http:// siteweb。 com/* => http://siteweb.com/index.HTML 其實您的代碼只適用於site.com => www.site.com – user1271775