![](/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.