我的网站包含以下htaccess文件:
RewriteRule ^declinare/([^/]+)/? declinare.php?cuvant=$1 [L,NC,QSA]
RewriteRule ^conjugare/([^/]+)/? conjugare.php?cuvant=$1 [L,NC,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]*)/?$ definitie.php?forma=$1&cuvant=$2 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]*)/([^/]*)/?$ definitie.php?forma=$1&cuvant=$2&pagina=$3 [L,QSA]
RewriteCond %{HTTP_HOST} ^toatecuvintele\.ro$ [OR]
RewriteCond %{HTTP_HOST} ^www\.toatecuvintele\.ro$
RewriteRule ^index\.php$ "http\:\/\/www\.toatecuvintele\.ro\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^toatecuvintele.ro$
RewriteRule ^/?$ "http\:\/\/www\.toatecuvintele\.ro\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^37\.156\.32\.57
RewriteRule (.*) http://www.toatecuvintele.ro/$1 [R=301,L]
除了一件事,一切正常: http://toatecuvintele.ro/cuvant/test不会自动重定向到http://www.toatecuvintele.ro/cuvant/test
如何将非WWW重定向到www?
谢谢。
答案 0 :(得分:0)
你试过吗:
RewriteCond %{HTTP_HOST} ^toatecuvintele\.ro$ [OR]
RewriteCond %{HTTP_HOST} ^www\.toatecuvintele\.ro$
RewriteRule ^(.*)$ http://www.toatecuvintele.ro$1" [R=301,L]
答案 1 :(得分:0)
你可以这样做:
RewriteCond %{HTTP_HOST} ^toatecuvintele\.ro$
RewriteRule ^/?(.*) http://www.toatecuvintele.ro/$1" [R=301,L]