开发者

NGINX Re-write only if url has no extension

开发者 https://www.devze.com 2023-02-15 10:32 出处:网络
I\'m trying to rewrite requests for anything without a file extension to pass to a script. For example:

I'm trying to rewrite requests for anything without a file extension to pass to a script.

For example:

example.com/admin.php will go to admin.php but http://www.example开发者_JAVA百科.com/param will be rewritten to http://example.com/test.php?do=param

I have it so that it will rewrite the param to ?do=param, but I can't figure out how to only do that if there is no '.' in the file name.


Try the if directive from the rewrite module:

if ( $uri !~ \. ) {  rewrite .....; }
0

精彩评论

暂无评论...
验证码 换一张
取 消