问题
I have been using tuckey Apache mod-rewrite engine to rewrite urls. But I have problems in escaping dots to decorate URLS as shown below,
www.example.com/hello.world -> www.example.com/derive.php
Following rules are the ones I have written to do the above thing,
RewriteRule ^/?(([A-Za-z0-9:-])+([.]*))$ /derive.php[L]
(RewriteRule ^/?(([A-Za-z0-9:-\.])+)$ /derive.php[L]
is not allowed by tuckey)
I think this question can be answered perfectly by people those who have used tuckey to decorate URLs.
回答1:
Inside a character class, dots don't have any special meaning, so it shouldn't be necessary to escape them; you should be able to write simply:
RewriteRule ^(?!/?derive[.]php$)/?[A-Za-z0-9:.-]+$ /derive.php [L]
来源:https://stackoverflow.com/questions/9646762/escaping-dot-in-apache-mod-rewrite