1
我的网站托管在Ubuntu的LAMP支持的VPS上。如何禁用302重定向
我不能使用不带www
的任何页面的直接链接。
即打字网址http://example.com/secondpage将重定向至http://www.example.com/。第二页丢失了。但http://www.example.com/secondpage完美。 我试过改变.htaccess
,但没效果。
你能帮我吗?
我的网站托管在Ubuntu的LAMP支持的VPS上。如何禁用302重定向
我不能使用不带www
的任何页面的直接链接。
即打字网址http://example.com/secondpage将重定向至http://www.example.com/。第二页丢失了。但http://www.example.com/secondpage完美。 我试过改变.htaccess
,但没效果。
你能帮我吗?
您需要使用您的这里面.htaccess
:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
如果这不起作用,你可以使用这个:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [nc]
RewriteRule ^(.*)$ http://www.example.com/$1 [r=301,nc]
我已经讲过了,它已经尝试了这些... 但没有效果。 :( – 2012-07-05 16:56:25
@KrishnaRajK你把你的'.htaccess'文件放在哪里? – 2012-07-05 16:59:28
在公共文件夹中 – 2012-07-05 17:21:58