1

I have just created a .htaccess file which I'm using in XAMPP, and is located in Z:/xampp/htdocs/.htaccess and I've added the code:

RewriteEngine on
RewriteCond % {REQUEST_FILENAME} !-f
RewriteCond % {REQUEST_FILENAME} !-d
RewriteRule ^ (.*)$1.php [L,QSA]

But when I load any of my pages I get the error:

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

I've seen others come across this error before and have tried other people's fixes but nothing has worked for me, when I stop getting the error, it doesnt remove the .php extension.

Does anyone know what the issue is?

ahmedg
  • 309
  • 1
  • 2
  • 12
dev_py_uk
  • 418
  • 1
  • 5
  • 20

1 Answers1

3

Try this

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

as well as in Apache httpd.conf check rewrite is on

Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85