2016-05-19 4 views
0
# @version 7.4 
# disable direct access to folders 
Options -Indexes 
# Follow symbolic links 
Options +FollowSymLinks 

<IfModule mod_rewrite.c> 
SetEnv HTTP_MOD_REWRITE on 

RewriteEngine On 

RewriteBase/

# if installed in root folder 
RewriteCond %{HTTP_HOST} !^www\. 
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] 

# if installed in subfolder 
#RewriteCond %{HTTP_HOST} !^www\. 
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/<subfolder>/$1 [R=301,L] 

# used to check if mod rewrite works 
RewriteRule ^test-mod-rewrite$ mod-rewrite.php [NC,L] 

# redirect all requests to index.php 
RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L] 
RewriteRule ^.*$ index.php [NC,L] 

</IfModule> 

# 7 DAYS 
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> 
Header set Cache-Control "max-age=604800, public" 
</FilesMatch> 

# 1 DAY - will prohibit the abuse on generating the sitemap xml file 
<FilesMatch "\.(xml|txt)$"> 
Header set Cache-Control "max-age=86400, public, must-revalidate" 
</FilesMatch> 

# using apache mod_deflate for compressing static content 
<IfModule mod_deflate.c> 
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript 
</IfModule> 

このコードは私にSEOフレンドリーなURLを生成すると思われますが、内部サーバーのエラーが発生しています。 mod_rewriteをインストールして有効にしました。助けてください。私の.htaccessファイルの内容を探します。.htaccessが内部サーバーエラーを引き起こしています

+0

サーバーのエラーログを調べて、エラーの原因とその原因を正確に調べます。 –

+0

/var/log/apache2/error.logが空です。 –

+1

OK <ファイルマッチ> \。(ico | pdf | flv | jpg | jpeg | png | gif | js | css | swf)$ "> の作業が開始されるまでコメントをつけてコメントを外してコメントアウトして、ヘッダーセットキャッシュコントロール "max-age = 604800、public" –

答えて

1

エラーが

# 7 DAYS 
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> 
Header set Cache-Control "max-age=604800, public" 
</FilesMatch> 

# 1 DAY - will prohibit the abuse on generating the sitemap xml file 
<FilesMatch "\.(xml|txt)$"> 
Header set Cache-Control "max-age=86400, public, must-revalidate" 
</FilesMatch> 

MOD HEADERは私のApacheウェブサーバにロードされていなかった以下の2つのセクションにありました。

関連する問題