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?

4
  • What does the error log say? You should be able to access it through XAMPP's control panel. Commented Nov 19, 2015 at 9:32
  • are you sure mode rewrite is on? Commented Nov 19, 2015 at 9:33
  • This line RewriteRule ^(.*)$1.php [L,QSA] has the problem , there should be a space between RewritePattern and the rewrite path, (.*) $1.php ( (.*)space$1.php ) Commented Nov 19, 2015 at 9:52
  • @NullPoiиteя Yes rewrite is on Commented Nov 19, 2015 at 11:08

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

2 Comments

This worked, I just hadn't removed the extension from the links so it was still showing up. Thanks!
@drewith happy to help :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.