2011-12-12 13 views
0

URLバーに自分のサイトに存在しないページを手動で入力すると、サイトが内部サーバーエラーで応答することがわかりました。ページが存在しない場合の内部サーバーエラー

404ページが見つかりませんか?

私のサイトはhttp://www.cristianrgreco.comです。たとえば、http://www.cristianrgreco.com/exampleはサーバーエラーを返します。

これは私が頻繁に発生したエラーです.htaccessファイルを使用しているので、私は下に掲載しています。

RewriteEngine On 
Options +FollowSymLinks 

# Add WWW to URL 
RewriteCond %{HTTP_HOST} ^cristianrgreco\.com$ [NC] 
RewriteRule ^(.*)$ http://www.cristianrgreco.com/$1 [L,R=301] 

# Remove trailing slashes from end of URL 
RewriteCond %{HTTP_HOST} !^\.cristianrgreco\.com$ [NC] 
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [L,R=301] 

# Rewrite article URLs 
RewriteRule ^articles/([a-zA-Z0-9_-]+)/?$ articles.php?article=$1 

# Remove file extension from PHP files 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ $1.php [L,QSA] 

ご協力いただきありがとうございます。

+0

言います。 –

答えて

1

私は前にこの問題が発生した、問題の行

RewriteRule ^(.*)$ $1.php [L,QSA]

RewriteRule ^([^\.]+)$ $1.php [NC,L,QSA]で置き換えているがトリックTODOようです。囲み括弧は、一致するものがRewriteRuleによって記憶されることを示します。括弧内には、それはあなたが代わりに[プロのウェブマスター](http://webmasters.stackexchange.com/)を試してみてください

<IfModule mod_rewrite.c> 
    Options +FollowSymLinks 
    Options +Indexes 
    RewriteEngine On 
    # Add WWW to URL 
    RewriteCond %{HTTP_HOST} ^cristianrgreco\.com$ [NC] 
    RewriteRule ^(.*)$ http://www.cristianrgreco.com/$1 [L,R=301] 

    # Remove trailing slashes from end of URL 
    RewriteCond %{HTTP_HOST} !^\.cristianrgreco\.com$ [NC] 
    RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [L,R=301] 

    # Rewrite article URLs 
    RewriteRule ^articles/([a-zA-Z0-9_-]+)/?$ articles.php?article=$1 

    # Remove file extension from PHP files 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{SCRIPT_FILENAME} !-d 
    RewriteRule ^([^\.]+)$ $1.php [NC,L,QSA] 
</IfModule> 
+0

絶対に華麗で、決して自分自身を考え出したことはありません。本当にありがとう! – Cristian

関連する問題