2016-09-20 13 views
0

www以外のすべてのURLとhttps以外のすべてのURLをhttpsにリダイレクトして、wwwからhtaccessに変更したいとします。htaccessからwwwを使用してhttpsを強制的に実行する

私はライブURLがwww.gpe360.comある

私は私の既存のhtaccessのコードを共有しています
php_value post_max_size 2000M 
php_value upload_max_filesize 2000M 
php_value memory_limit 100000M 
php_value max_execution_time 1000000 

#### Rule for Error Page - 404 #### 
ErrorDocument 404 http://gpe360.com/index_home.php 

# compress text, html, javascript, css, xml: 
AddOutputFilterByType DEFLATE text/plain 
AddOutputFilterByType DEFLATE text/html 
AddOutputFilterByType DEFLATE text/xml 
AddOutputFilterByType DEFLATE text/css 
AddOutputFilterByType DEFLATE application/xml 
AddOutputFilterByType DEFLATE application/xhtml+xml 
AddOutputFilterByType DEFLATE application/rss+xml 
AddOutputFilterByType DEFLATE application/javascript 
AddOutputFilterByType DEFLATE application/x-javascript 

# Or, compress certain file types by extension: 
<Files index.html> 
SetOutputFilter DEFLATE 
</Files> 

<IfModule mod_expires.c> 
# Enable expirations 
ExpiresActive On 
# Default directive 
ExpiresDefault "access plus 1 month" 
# My favicon 
ExpiresByType image/x-icon "access plus 1 year" 
# Images 
ExpiresByType image/gif "access plus 1 month" 
ExpiresByType image/png "access plus 1 month" 
ExpiresByType image/jpg "access plus 1 month" 
ExpiresByType image/jpeg "access plus 1 month" 
# CSS 
ExpiresByType text/css "access 1 month" 
# Javascript 
ExpiresByType application/javascript "access plus 1 year" 
</IfModule> 

<ifModule mod_gzip.c> 
mod_gzip_on Yes 
mod_gzip_dechunk Yes 
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$ 
mod_gzip_item_include handler ^cgi-script$ 
mod_gzip_item_include mime ^text/.* 
mod_gzip_item_include mime ^application/x-javascript.* 
mod_gzip_item_exclude mime ^image/.* 
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* 
</ifModule> 

#Gzip 
<ifmodule mod_deflate.c> 
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript 
</ifmodule> 
#End Gzip 

Options +ExecCGI +FollowSymLinks 
RewriteEngine On 

RewriteRule ^villas/rent.php$ rent.php?$1 [QSA] 

RewriteRule ^house/homes.php$ homes.php?$1 [QSA] 

RewriteRule ^apartment/apartment.php$ apartment.php?$1 [QSA] 
RewriteRule ^apartmentland/land.php$ land.php?$1 [QSA] 

RewriteRule ^(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$ property_details.php?id=$2 
RewriteRule ^region--(.*)--(.*)\.html$ region_details.php?rid=$1 
RewriteRule ^cyprus_details\.html$ cyprus_details.php 
RewriteRule ^agent-(.*)-(.*)\.html$ view_public_profile.php?uid=$1 
RewriteRule ^News-(.*)-(.*)\.html$ news_detail.php?id=$1 
RewriteRule ^Resource-(.*)-(.*)\.html$ useful_resource_details.php?rid=$1 
RewriteRule ^independent_account.php(.*) /makepayment/account.php?ac_type=2 [R=301,L] 
RewriteRule ^professional_account.php(.*) /makepayment/account.php?ac_type=3 [R=301,L] 

RewriteCond %{HTTP_HOST} ^gpe360\.com$ [NC] 
RewriteRule ^(.*)$ http://www.gpe360.com/$1 [R=301,L] 
ErrorDocument 404 http://www.gpe360.com 
#Options -Idexes 

をグーグルで多くのコードを試みたが、

私の問題を解決することができませんでした。

+0

あなたが試した数百万のソリューションのすべてがあなたのために働かなかったことを私たちに教えてください。私は彼らが働くことを意味します、なぜあなたのためにではありませんか?あなたの実際の問題は何ですか? 「うまくいかない」とはどういう意味ですか?これは、あなたが物事をどうやってやっているのかわからないかのように読んで、他の人があなたの仕事のやり方を教えてくれると期待しています。 – arkascha

+0

エラーは「多くのリダイレクトに」です。 – PlanetHackers

+0

これはかなり正確なエラーです。そのエラーを受け取ったときに試した正確なコードに沿ってのみ意味があります。 – arkascha

答えて

0

は、あなたのコード内のテストのための以前の試みを削除するだけでRewriteEngine on

RewriteCond {HTTPS} on 
RewriteCond {HTTP_HOST} !^www 
RewriteRule^https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R] 

後にこのルールを試してみてください。

+0

cssファイルとjsファイルをリダイレクトしません – PlanetHackers

+0

これをあなたのhtmlページ ''で使ってみてください。 exampleをホスト名に置き換えます。 –

関連する問題