强制WWW与httpd.conf文件,而不是的.htaccess

编程入门 行业动态 更新时间:2024-10-19 17:26:00
本文介绍了强制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

本文发布于:2023-11-01 01:40:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547875.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:而不   文件   httpd   WWW   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!