Www and non www sites(Www 和非 www 站点)
问题描述
我有一个域名 http://www.testexample.com.当我登录 http://www.testexample.com 并返回 http://testexample.com 在浏览器中;不显示登录的用户信息.
我知道以上两者的处理方式不同,因此它不会保留 http://www.testexample.com 的会话 在访问 http://testexample.com 时.
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
我使用以下代码从一个 URL 重定向到另一个
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 站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Www 和非 www 站点
- SoapClient 设置自定义 HTTP Header 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- Laravel 仓库 2022-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
