Search code examples
.htaccessmod-rewriteinternal-server-error

htaccess internal server error


When I goto http://example.com/not-here I get an internal server error instead of an 404, here is my htaccess file (it removes the extension so abc.php can be accessed as example.com/abc instead of example.com/abc.php):

Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /$1.php [L,QSA]

DirectoryIndex login.php index.php

ErrorDocument 403 /error.php?type=403
ErrorDocument 404 /error.php?type=404
ErrorDocument 500 /error.php?type=500

Its proberly something really simple but I cannot see it, any help is appriciated


Solution

  • I should have in the .htaccess the following:

    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{QUERY_STRING} !rewrited
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)$ /$1.php?rewrited=1 [L,QSA]
    
    DirectoryIndex login.php index.php
    
    ErrorDocument 403 /error.php?type=403
    ErrorDocument 404 /error.php?type=404
    ErrorDocument 500 /error.php?type=500