2013-08-30 159 views
1

我有我的重定向和即時通訊猜測它的問題,因爲我保持複製和粘貼我的htaccess規則。重定向HTTPS到HTTP和非WWW到WWW

我需要將所有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 

回答

2

您可以結合:

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] 
相關問題