Reputation: 4636
I would like to redirect all:
<a href="filename"></a>
to
<a href="get.php?filename"></a>
I have started to
RewriteRule !\.(html|php)$ /get.php?file=$1 [PT]
But it does not work.
Upvotes: 2
Views: 1520
Reputation: 272246
I've tested this regexp in PHP it should work in mod_rewrite but I have not tested it and seems to work in mod_rewrite too:
RewriteRule ^(.+)(?<!\.php)(?<!\.html)$ /get.php?file=$1
The rule will rewrite all URLs except those that end with .php or .html.
Upvotes: 6
Reputation: 20612
The most basic way to handle that is:
RewriteRule ^(.*)$ get.php?file=$1 [QSA,L]
Which will redirect everything, setting file
to the value of the path.
Upvotes: 1