I just did a fresh install of lamp stack on ubuntu and enabled the mod_rewrite module for my default website. What I want is something similar to the drupal’s queries, when the whole query string is kept in one variable. For this purposes the following mod_rewrite code may be used:
RewriteRule ^(.*)$ home.php?q=$1 [L,QSA]
The problem begins when some a string starts with the name of the file already existing in the directory;
For example if I open a page: http://localhost/home/blablabla – the contents of $_GET are as follows:
Array ( [q] => home.php )
What I want to see is:
Array ( [q] => home/blablabla )
I think it’s something with default website or mod_rewrite configuration, but I just couldn’t figure it out…
You have to exclude the
home.php:Or you exclude every existing file:
The reason: The
Lflag causes an internal redirect with the new rewritten URL. And the new URLhome.phpis also matched by the expression^(.*)$.