【问题标题】:htaccess file www. redirect issuehtaccess 文件 www.重定向问题
【发布时间】:2013-12-08 08:57:56
【问题描述】:

我有一个奇怪的问题

我将代码添加到 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 *

我不确定这是否正确,请检查并让我知道我能做些什么来解决这个问题

提前非常感谢

【问题讨论】:

    标签: apache .htaccess mod-rewrite redirect web


    【解决方案1】:

    此问题与 mod-rewrite 无关。

    不如向您的服务提供商(cpanel 所在的位置)寻求帮助。

    【讨论】:

      猜你喜欢
      • 2011-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-03
      • 1970-01-01
      • 2020-09-17
      • 1970-01-01
      • 2017-09-08
      相关资源
      最近更新 更多