[英]Redirect HTTPS to HTTP and NON WWW to WWW
我的重定向存在问题,我猜测是因为我一直复制并粘贴htaccess规则。
我需要将所有https流量重定向到http,将所有非www重定向到www。 我还有更多规则可以建立漂亮的链接
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
RewriteRule (.*\.php)\.$ /$1 [R=301,L]
RewriteRule ^people/([^/]*)/([^/]*)/([^/]*)$ /profile.php?county=$1&name=$2&id=$3 [L]
RewriteRule ^people-in-(.*) /people.php?county=$1 [L]
RewriteCond %{HTTP_HOST} ^ties\.co.uk$
RewriteRule (.*) http://www.ties.co.uk/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/index.php$
RewriteRule (.*) / [R=301,L]
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
ErrorDocument 404 /notfound.php
您可以结合:
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
和
RewriteCond %{HTTP_HOST} ^ties\.co.uk$
RewriteRule (.*) http://www.ties.co.uk/$1 [R=301,L]
变成需要在RewriteEngine On
下面的单个规则:
RewriteCond %{HTTPS} on [OR]
RewriteCond %{HTTP_HOST} ^ties\.co\.uk$ [NC]
RewriteRUle ^(.*)$ http://www.ties.co.uk/$1 [R=301,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.