apache - Internal Server Error when file or folder does not exists -


i use rewrite code rewrite requests .php file:

rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule (.*)$ $1.php [l] 

so when enter index index.php load or if enter contact contact.php load.

but when enter name not exists internal server error, example entered name test or fdgdfg/ewrtt/ddfghdfg, after error:

internal server error  server encountered internal error or misconfiguration , unable complete request.  please contact server administrator, webmaster@mydomain.com , inform them of time error occurred, , might have done may have caused error.  more information error may available in server error log.  additionally, 500 internal server error error encountered while trying use errordocument handle request. 

i have errordocument 404 error.php in .htaccess.

this complete .htaccess file :

errordocument 404 index.php rewriteengine on rewritebase  /shop rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule (.*)$ $1.php [l] 

following solved problem -

rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewritecond %{request_filename}\.php -f rewriterule ^([^\.]+)$ $1.php [nc] 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -