![](/img/trans.png)
[英]Redirect all non-www, www, http:// requests to https://www. using .htaccess file
[英]htaccess file www. redirect issue
我有一个奇怪的问题
我将代码添加到htaccess文件中,以将任何非www重定向到www。 但现在将我带到网站文件所在的子目录中
从DNS cpanel我已将域目录指向/ main_web
当我现在输入throughtheglasseye.org时,它进入hxxp://www.throughtheglasseye.org/Main_web/,但未找到错误404页面
这是我的代码-
# Redirect non-www to www:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
# Disable htaccess view:
<Files .htaccess>
order allow,deny
deny from all
# Disable directory browsing:
</Files>
IndexIgnore *
即时通讯不确定这是否正确,请检查并告知我该怎么做才能解决此问题
提前谢谢
此问题与mod-rewrite不相关。
而是向您的服务提供商(cpanel所在的位置)寻求帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.