.htaccess不会将所有页面重定向到非www版本

时间:2017-09-23 03:39:58

标签: apache .htaccess

相关网站为https://thefriendlygearpage.com

如果你访问它,你会发现它工作正常。

现在转到https://www.thefriendlygearpage.com

它不起作用,如果你查看URL栏,它会从最后删除.com。

不要转到https://www.thefriendlygearpage.com/forums/forum-issues-reporting.230/

该页面工作正常,并将您重定向到页面的非www版本,应该如此。

我可以说,除主页外,网站中的每个页面都运行正常。如果您转到该网站的www版本,它应该将您重定向到非www版本,简单明了。

这是我的.htaccess文件,只是有帮助。我在这里难过!

#   Mod_security can interfere with uploading of content such as attachments. If you
#   cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#   SecFilterEngine Off
#   SecFilterScanPOST Off
#</IfModule>

 ErrorDocument 401 default
 ErrorDocument 403 default
 ErrorDocument 404 default
 ErrorDocument 405 default
 ErrorDocument 406 default
 ErrorDocument 500 default
 ErrorDocument 501 default
 ErrorDocument 503 default

 <IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.thefriendlygearpage\.com [NC]
RewriteRule ^(.*)$ https://thefriendlygearpage.com/$1 [L,R=301]

RewriteEngine On

#    If you are having problems with the rewrite rules, remove the "#" from the
#    line that begins "RewriteBase" below. You will also have to change the path
#    of the rewrite to reflect the path to your XenForo installation.
#RewriteBase /xenforo

#    This line may be needed to enable WebDAV editing with PHP as a CGI.
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>

1 个答案:

答案 0 :(得分:0)

哇...愚蠢的我。它只不过是一个缓存的浏览器错误。我清除了浏览器缓存,现在工作正常。