繁体   English   中英

将 nginx 重写规则转换为 htaccess/apache 重写规则

[英]Convert nginx rewrite rules to htaccess/apache rewrite rules


我想从 nginx 迁移到 apache2。 但我无法弄清楚如何将 nginx 重写规则“转换”为 apache/htaccess 重写规则。

    location / {
            try_files $uri $uri/ /index.php;
            if ($uri ~* ^/([a-z]+)$) {
                    set $page_to_view "/index.php?p=$1";
                    rewrite ^/([a-z]+)$ /index.php?p=$1 last;
            }
    }

谢谢! =)

这对我来说很好用! 在这种情况下,我不得不说我自己查这些东西并不是很聪明......

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM