0

Here is my source code.

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

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log.

Michael Berkowski
  • 267,341
  • 46
  • 444
  • 390
Lester1992
  • 493
  • 2
  • 9
  • 20
  • Whenever you get a 500 error, look in Apache's error log. It will be detailed there in the log. – Michael Berkowski Feb 22 '14 at 00:35
  • 3
    Looking at this, I would bet it is due to an infinite rewrite loop, since you do not have the `[L]` flag on the rewrite. A request to `/thing` will result in `/thing.php.php.php.php.php.php.php....` until Apache gives up. The error log will tell you for sure. – Michael Berkowski Feb 22 '14 at 00:50
  • [Sat Feb 22 08:53:48.038885 2014] [core:alert] [pid 4540:tid 1588] [client ::1:2173] C:/wamp/www/MIS_Beta/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration - what does this mean? – Lester1992 Feb 22 '14 at 00:55
  • 2
    Ok then, you don't have mod_rewrite enabled. See [this question for more info](http://stackoverflow.com/questions/10144634/htaccess-invalid-command-rewriteengine-perhaps-misspelled-or-defined-by-a-m) – Michael Berkowski Feb 22 '14 at 00:56
  • 1
    Once you have the module enabled, go ahead and add the `[NC,L]` to your `RewriteRule` since I suspect you're going to need it. – Michael Berkowski Feb 22 '14 at 00:57
  • is it posible that i can hide the whole filename? – Lester1992 Feb 22 '14 at 01:06
  • What do you mean by hide the whole filename? Give an example input url and what it would be rewritten as – Michael Berkowski Feb 22 '14 at 01:29
  • localhost/MIS/names.php to localhost/MIS/ something like this. is it posible? – Lester1992 Feb 22 '14 at 02:11
  • Using above rule you can use: `localhost/MIS/names` – anubhava Feb 22 '14 at 06:56

1 Answers1

2

First of all make sure your apache has mod_rewrite on. I could explain how to do it on Linux, but since you have WAMP on Windows, it is different there, but sure you can google for it to find out.

Second, your RewriteRule is missing [L] flag which would tell to Apache that this is a last rule to be applied for this request. But this missing flag would not cause error you give in comments. So first option to look for is to whether mod_rewrite is enabled or not.

As someone suggested in comments: please take a look at this answer, it gives whole walkthrough on how to enable mod_rewrite: https://stackoverflow.com/a/13633635/1297136

Community
  • 1
  • 1
Alexey Kamenskiy
  • 2,888
  • 5
  • 36
  • 56