2011-12-12 6 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

당신은 [프로 웹 마스터 (http://webmasters.stackexchange.com/) 대신에 시도 할 수 있습니다 말한다. –

답변

1

문제가 RewriteRule ^([^\.]+)$ $1.php [NC,L,QSA]로 대체이 선

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

에게 있습니다 트릭 할 일 것으로 보인다. 둘러싸는 대괄호는 일치하는 모든 것이 RewriteRule에 의해 기억된다는 것을 나타냅니다. 괄호 내부, 그것은

<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

관련 문제