Www和非www网站 [英] Www and non www sites

查看:256
本文介绍了Www和非www网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个域名 http://www.testexample.com 。当我登录到 http://www.testexample.com 时,返回 http://testexample.com ;将不显示登录的用户信息。

我知道上述两者都有不同的处理,因此它不保留 http://www.testexample.com 访问 http://testexample.com a>。

I have a domain say http://www.testexample.com. When I login to http://www.testexample.com and come back to http://testexample.com in browser; the logged in user information is not displayed.
I know that the both of the above are treated differently and hence it is not retaining the session for http://www.testexample.com while accessing http://testexample.com.

请让我知道cakephp是否有办法在TLD上做匹配。因此,每当我输入 http://testexample.com 时,都应该为 http://www.testexample.com

Please let me know if cakephp has a way to do a match on the TLD. So whenever I type http://testexample.com it should take session for http://www.testexample.com

我使用以下代码从一个网址重定向到其他

I am using the following code to redirect from one URL to the other

RewriteCond %{HTTPS} off   
RewriteCond %{HTTP_HOST} ps6309 [NC]   
RewriteRule ps6309.domain.co.in [L,R=301]

这是在我的本地测试机。这有时工作,有时不工作。

此外,我已经添加了rewritelog指令到我的httpd.conf文件。
但日志文件未更新。
如果任何人有任何指示,请让我知道。

this is on my local test machine. This works sometimes and sometimes doesn't.
Also I have added the rewritelog directive to my httpd.conf file. But the log file is not getting updated. Please let me know if anyone has any pointers to this.

推荐答案

使用.htaccess重定向所有 http:// domain .com - > http://www.domain.com

Use .htaccess to redirect all http://domain.com -> http://www.domain.com

RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]

这篇关于Www和非www网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆