开发者

How do i convert this Mod_rewrite rule to nginx

This is the Htacces rule:

RewriteEngine on
RewriteRule ^([A-Za-z0-9-]+)/?$ ir.php?id=$1

how should I pass it to a Nginx compliant rewrite rule... i read the doc and开发者_如何转开发 did this:

rewrite ^([A-Za-z0-9-]+)/?$ ir.php?id=$1 last;

But didnt work. and another question: Is there any equivalent of .htaccess to Nginx (per directory rules) Thanks


As an answer to your second question: no, there is no equivalent for Apache's .htaccess files for per directory configuration. You can have per directory configuration files included via the master config, but Nginx would need to be reloaded every time a config include file changed.


Finally, could solve it... rewrite ^([A-Za-z0-9-]+)/?$ ir.php?id=$1 last; To rewrite ^/([A-Za-z0-9-]+)/?$ /ir.php?id=$1 last;

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜