对不起,我搜索了,但没有找到我的解决方案我有一个http://www项目在我的主机上位于一个文件夹www,在这个文件夹中有所有的文件的应用程序和我的.htaccess文件,我想所有的链接:www...被重定向到http://..。(没有www)因为我和google有问题。
下面是我的.htaccess文件的内容
RewriteEngine On
## www -> no-www
RewriteCond %{HTTP_HOST} ^www\.(.+)$
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L,NE,QSA]
## http -> https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,QSA]但它不起作用,如果我用两个urls去我的网站,我没有重定向
发布于 2019-08-09 14:32:08
将此规则添加到.htaccess文件的顶部
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# www -> no-www
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule (.*) https://example.com/$1 [R=301,L]
# http -> https
RewriteCond %{HTTPS} off
RewriteRule (.*) https://example.com/$1 [R=301,L]
</IfModule>https://stackoverflow.com/questions/57311513
复制相似问题