Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将nginx重写规则转换为htaccess/apache重写规则_Apache_.htaccess_Mod Rewrite_Nginx_Url Rewriting - Fatal编程技术网

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

将nginx重写规则转换为htaccess/apache重写规则,apache,.htaccess,mod-rewrite,nginx,url-rewriting,Apache,.htaccess,Mod Rewrite,Nginx,Url Rewriting,我想从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 ^/([


我想从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]