2016-12-13 15 views
0

私の.htaccessファイルに問題があります。ページが正しくリダイレ​​クトされていません - .htaccessファイルの問題

前::私はいくつかの変更(追加、多言語処理)を行わまで すべてが正常に働いていた

RewriteEngine On 

RewriteBase/
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] 
RewriteRule ^(.*)$ http://%1/$1 [R=301,L] 
RewriteRule ^(index.html)$ http://my-site.pl/ [R=301,L] 

私は、ファイルの末尾に追加されているもの:私が欲しい

RewriteCond %{HTTP:Accept-Language} (pl) [NC] 
RewriteRule .* index.html [R,L] 
RewriteCond %{HTTP:Accept-Language} (en) [NC] 
RewriteRule .* index.en.html [R,L] 
RewriteCond %{HTTP:Accept-Language} (jp) [NC] 
RewriteRule .* index.jp.html [R,L] 

私のページのURL(0120-)のみを変更して、すべての国を自分のページにリダイレクトします。

どこに問題があるのか​​わかりません。 Firefoxブラウザから

エラー:

ページが正しくリダイレ​​クトされていません。 Firefoxは サーバーがこのアドレスの要求を が完了しないようにリダイレクトしていることを検出しました。

EDIT: 変化(まだ動作していない)完全に.htaccess後:

RewriteEngine On 
RewriteBase/

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] 
RewriteRule^http://%1%{REQUEST_URI} [R=301,L,NE] 

RewriteCond %{THE_REQUEST} /index\.html [NC] 
RewriteRule ^index\.html$/[R=301,L,NC] 

RewriteCond %{HTTP:Accept-Language} pl [NC] 
RewriteRule ^(?!index\.html$).+$/[NC,R,L] 

RewriteCond %{HTTP:Accept-Language} en [NC] 
RewriteRule ^/?$ index.en.html [R,L] 

RewriteCond %{HTTP:Accept-Language} jp [NC] 
RewriteRule ^/?$ index.jp.html [R,L] 

ErrorDocument 404 /404.html 

## EXPIRES CACHING ## 
<IfModule mod_expires.c> 
ExpiresActive On 
ExpiresByType image/jpg "access 1 year" 
ExpiresByType image/jpeg "access 1 year" 
ExpiresByType image/gif "access 1 year" 
ExpiresByType image/png "access 1 year" 
ExpiresByType text/css "access 1 month" 
ExpiresByType text/html "access 1 month" 
ExpiresByType application/pdf "access 1 month" 
ExpiresByType text/x-javascript "access 1 month" 
ExpiresByType application/x-shockwave-flash "access 1 month" 
ExpiresByType image/x-icon "access 1 year" 
ExpiresDefault "access 1 month" 
</IfModule> 
## EXPIRES CACHING ## 
<IfModule mod_deflate.c> 
    # Compress HTML, CSS, JavaScript, Text, XML and fonts 
    AddOutputFilterByType DEFLATE application/javascript 
    AddOutputFilterByType DEFLATE application/rss+xml 
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject 
    AddOutputFilterByType DEFLATE application/x-font 
    AddOutputFilterByType DEFLATE application/x-font-opentype 
    AddOutputFilterByType DEFLATE application/x-font-otf 
    AddOutputFilterByType DEFLATE application/x-font-truetype 
    AddOutputFilterByType DEFLATE application/x-font-ttf 
    AddOutputFilterByType DEFLATE application/x-javascript 
    AddOutputFilterByType DEFLATE application/xhtml+xml 
    AddOutputFilterByType DEFLATE application/xml 
    AddOutputFilterByType DEFLATE font/opentype 
    AddOutputFilterByType DEFLATE font/otf 
    AddOutputFilterByType DEFLATE font/ttf 
    AddOutputFilterByType DEFLATE image/svg+xml 
    AddOutputFilterByType DEFLATE image/x-icon 
    AddOutputFilterByType DEFLATE text/css 
    AddOutputFilterByType DEFLATE text/html 
    AddOutputFilterByType DEFLATE text/javascript 
    AddOutputFilterByType DEFLATE text/plain 
    AddOutputFilterByType DEFLATE text/xml 

    # Remove browser bugs (only needed for really old browsers) 
    BrowserMatch ^Mozilla/4 gzip-only-text/html 
    BrowserMatch ^Mozilla/4\.0[678] no-gzip 
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html 
    Header append Vary User-Agent 
</IfModule> 

答えて

0

問題index.htmlにリダイレクトされ、第2のルールは、このようにリダイレクトループを引き起こす/index.htmlをリダイレクトしている第3のルールであります。

はこのようにそれを持っている:

RewriteEngine On 
RewriteBase/

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] 
RewriteRule^http://%1%{REQUEST_URI} [R=301,L,NE] 

RewriteCond %{THE_REQUEST} /index\.html [NC] 
RewriteRule ^index\.html$/[R=301,L,NC] 

RewriteCond %{HTTP:Accept-Language} pl [NC] 
RewriteRule ^(?!index\.html$).+$/[NC,R,L] 

RewriteCond %{HTTP:Accept-Language} en [NC] 
RewriteRule ^/?$ index.en.html [R,L] 

RewriteCond %{HTTP:Accept-Language} jp [NC] 
RewriteRule ^/?$ index.jp.html [R,L] 

は、テストしながら、お使いのブラウザのキャッシュをクリアすることを確認します。

+0

残念ながらまだ動作していません...同じエラー...キャッシュがクリアされるたびに – Krzysiek

+0

同じエラーが表示されます。携帯電話でFirefoxとインターネットエクスプローラでテスト済み – Krzysiek

+0

plのリダイレクトルールに問題があります。これがなければすべてが機能しますが、残念ながらすべてのページがen – Krzysiek

関連する問題