开发者

How do i convert this Mod_rewrite rule to nginx

开发者 https://www.devze.com 2022-12-23 09:09 出处:网络
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:

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

精彩评论

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

关注公众号