本文介绍了强制WWW与httpd.conf文件,而不是的.htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在许多部队WWW读了起来。使用htaccess的把戏。 (如下图)
I've read up on many Force WWW. tricks using htaccess. (As Below)
Rewritecond %{HTTP_HOST} !^www\.domain\ RewriteRule (.*) www.domina/$1 [R=301,L]
我不知道是否有一种方法在整个网站中使用httpd.config强制WWW。
I'm wondering if there is a method to force WWW using httpd.config across the entire site.
htaccess的作品一种享受,但我有很多子目录,其中大部分包含有自己的.htacess文件,它打破了WWW力在特定的子目录。
The htaccess works a treat, but I have many subdirectories, most of them include there own .htacess files, which breaks the force www in that particular subdirectory.
所以,我在想,有没有办法迫使这个WWW。进入httpd.config,跨不进行编辑的.htaccess整个网站?
So I was thinking, is there a way to force this "www." into httpd.config, across the entire site without editing .htaccess?
感谢。
推荐答案这应该做到这一点:
RewriteEngine on RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^ www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]和维护HTTPS过:
RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]更多推荐
强制WWW与httpd.conf文件,而不是的.htaccess
发布评论