简体   繁体   English

htaccess文件www。 重定向问题

[英]htaccess file www. redirect issue

I have a weird issue 我有一个奇怪的问题

I added the code to htaccess file to redirect any non www to www. 我将代码添加到htaccess文件中,以将任何非www重定向到www。 but now it takes me to the sub-directory the website files are on 但现在将我带到网站文件所在的子目录中

from the DNS cpanel i have pointed the domain directory to /main_web 从DNS cpanel我已将域目录指向/ main_web

when i put in throughtheglasseye.org now it takes to hxxp://www.throughtheglasseye.org/Main_web/ with the error 404 page not found 当我现在输入throughtheglasseye.org时,它进入hxxp://www.throughtheglasseye.org/Main_web/,但未找到错误404页面

here is my code - 这是我的代码-

# 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 *

im not sure if this is correct please check and let me know what i can do to fix this 即时通讯不确定这是否正确,请检查并告知我该怎么做才能解决此问题

Thanks a lot in advance 提前谢谢

This issue is not related to mod-rewrite. 此问题与mod-rewrite不相关。

Rather ask help from your service provider (where cpanel is located). 而是向您的服务提供商(cpanel所在的位置)寻求帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将所有非www,www,http://请求重定向到https:// www。 使用.htaccess文件 - Redirect all non-www, www, http:// requests to https://www. using .htaccess file .htaccess重定向到https和www。 如果启用 - .htaccess redirect to https and www. if enabled .htaccess如果没有“ www”,则重定向到子目录。 在要求的网址中 - .htaccess redirect to subdirectory if no 'www.' in requested URL 如何将.htaccess重定向到www。 版? (不工作) - How redirect .htaccess to www. version? (not working) 如何使用从透明域重定向到www的.htaccess文件进行重定向? - How to redirect using .htaccess file that redirects from clear domain to www.? 如何在不使用 www 的情况下重定向到我的网站。 前缀 .htaccess 文件 - how can I redirect to my website without using www. prefix .htaccess file .htaccess文件没有重定向http:// www。 到https:// www - .htaccess file not redirecting http://www. to https://www htaccess重定向到www。 在一种情况下无法在负载均衡器后面工作 - htaccess redirect to www. not working behind load balancer in one scenario htaccess重定向https:// www。 (https://www.example.com)到非www(https://example.com) - htaccess redirect https://www. (https://www.example.com) to non www (https://example.com) .htaccess力www。 和Silex - .htaccess force www. and Silex
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM