NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
Alucns
V2EX  ›  NGINX

求 Apache Rewrite 转 Nginx Rewrite

  •  
  •   Alucns · May 1, 2022 · 2030 views
    This topic created in 1484 days ago, the information mentioned may be changed or developed.
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^([^./]+)/?$ $1.php [L]
    这条 Apache Rewrite 作用是:
    如: https://demo.com/api/validation.php 可以通过 https://demo.com/api/validation 访问;
    api/下面所有文件都可以这样访问;
    在 Nginx 下试了没有作用,求帮助,谢谢!
    location /api/ {
    try_files $uri $uri/ /api/$uri.php?$args;
    }
    Alucns
        1
    Alucns  
    OP
       May 1, 2022   ❤️ 1
    已解决:
    location / {
    try_files $uri $uri/ $uri.php$is_args$args;
    }
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2782 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 466ea39e · 39ms · UTC 10:27 · PVG 18:27 · LAX 03:27 · JFK 06:27
    ♥ Do have faith in what you're doing.