modRewrite ads a not neccessary ".php" to my URL

New to mod_rewrite? This is a good place to start.

modRewrite ads a not neccessary ".php" to my URL

Postby mard » Sun Jan 08, 2006 7:41 am


first of, I'm new to things belonging Apache and ModRewrite especially - didn't need detailed knowledge about it until some weeks ago.

What I wanted to do: All folders beyond a certain level should be treated as GET-Variable. Why? I don't like URLs like
- it would be nicer to have a URL like

and then letting Apache do the internal rewritings which then are used by my PHP-Script.

OK, I started on it - and it worked. But - not everytime. And now that's the problem:

My folderstructure is like this:

My htaccess-File is located in /doit/ and contains the following code:

Code: Select all
RewriteEngine on
RewriteRule !^img(.*)$  - [C]
RewriteRule  ^(.*)\/    index.php?param=$1      [L]

So everytime I have a link like ""
my PHP-Script get's a variable $_GET['param'] containing "admin/archer".

Works quite fine ...

... until a URL sounds like "" - having the folder and virtual subfolder both sounding alike ("doit")

In this case my PHP-Script get's a variable $_GET['param'] containing "doit.php/archer"

Now my big question: WHY? Why does RewriteEngine add a ".php" to my "doit" ?

thx in advance..
Posts: 1
Joined: Sun Jan 08, 2006 7:10 am

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 8 guests