escaping dot in Apache mod_rewrite

拟墨画扇 提交于 2020-01-06 09:31:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!