問題描述
我有一個域名 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 站點的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!