I would like to redirect all:
<a href="filename"></开发者_StackOverflowa>
to
<a href="get.php?filename"></a>
I have started to
RewriteRule !\.(html|php)$ /get.php?file=$1 [PT]
But it does not work.
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.
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.
精彩评论