Httacces到nginx(crowdphp)

时间:2016-06-01 11:24:09

标签: .htaccess nginx

有人可以解释我如何重写这个以使其与php-fpm(vestacp)一起使用?

这是一个CrowdPHP脚本。我们需要转移到php-fpm服务器,但是......似乎不可能为此制作一个合适的nginx模板。我试过使用一些在线转换器,但没有任何作用。

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on

RewriteRule ^project\/(.*)-id-([0-9]+)\.html$  index.php?ctl=deal&act=show&id=$2 [QSA,L]
RewriteRule ^project\/updates\/(.\d)\/$  index.php?ctl=deal&act=update&id=$1 [QSA,L]
RewriteRule ^project\/comments\/(.\d)\/$  index.php?ctl=deal&act=comment&id=$1 [QSA,L]
RewriteRule ^user\/(.\d)\/$  index.php?ctl=home&id=$1 [QSA,L]
RewriteRule ^user\/(.\d)\/funded\/$  index.php?ctl=home&act=support&id=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

#Custom Rerites 
#RewriteRule ^projects-we-like.html$  index.php?ctl=article&id=77



RewriteRule ^article_cate$  index.php\?ctl=article_cate [QSA,L]
RewriteRule ^(about|Help|events|media|about-us|how-to)$  index.php\?ctl=article_cate&bs=$1 [QSA,L]
RewriteRule ^(about|Help|events|media|about-us|how-to)/([^\.&]*)\.html$  index.php\?ctl=article&id=$2 [QSA,L]

RewriteRule ^([^\.&]*)\.html$  index.php\?rewrite_param=$1 [QSA,L]
</IfModule>

1 个答案:

答案 0 :(得分:-1)

使用此

# nginx configuration location /project { rewrite ^/project\/(.*)-id-([0-9]+)\.html$ /index.php?ctl=deal&act=show&id=$2 break; rewrite ^/project\/updates\/(.\d)\/$ /index.php?ctl=deal&act=update&id=$1 break; rewrite ^/project\/comments\/(.\d)\/$ /index.php?ctl=deal&act=comment&id=$1 break; } location /user { rewrite ^/user\/(.\d)\/$ /index.php?ctl=home&id=$1 break; rewrite ^/user\/(.\d)\/funded\/$ /index.php?ctl=home&act=support&id=$1 break; } location / { if (!-e $request_filename){ rewrite ^/article_cate$ /index.php\?ctl=article_cate break; } rewrite ^/([^\.&]*)\.html$ /index.php\?rewrite_param=$1 break; } location /about { rewrite ^/(about|Help|events|media|about-us|how-to)$ /index.php\?ctl=article_cate&bs=$1 break; rewrite ^/(about|Help|events|media|about-us|how-to)/([^\.&]*)\.html$ /index.php\?ctl=article&id=$2 break; } location /Help { rewrite ^/(about|Help|events|media|about-us|how-to)$ /index.php\?ctl=article_cate&bs=$1 break; rewrite ^/(about|Help|events|media|about-us|how-to)/([^\.&]*)\.html$ /index.php\?ctl=article&id=$2 break; } location /events { rewrite ^/(about|Help|events|media|about-us|how-to)$ /index.php\?ctl=article_cate&bs=$1 break; rewrite ^/(about|Help|events|media|about-us|how-to)/([^\.&]*)\.html$ /index.php\?ctl=article&id=$2 break; } location /media { rewrite ^/(about|Help|events|media|about-us|how-to)$ /index.php\?ctl=article_cate&bs=$1 break; rewrite ^/(about|Help|events|media|about-us|how-to)/([^\.&]*)\.html$ /index.php\?ctl=article&id=$2 break; } location /about-us { rewrite ^/(about|Help|events|media|about-us|how-to)$ /index.php\?ctl=article_cate&bs=$1 break; rewrite ^/(about|Help|events|media|about-us|how-to)/([^\.&]*)\.html$ /index.php\?ctl=article&id=$2 break; } location /how-to { rewrite ^/(about|Help|events|media|about-us|how-to)$ /index.php\?ctl=article_cate&bs=$1 break; rewrite ^/(about|Help|events|media|about-us|how-to)/([^\.&]*)\.html$ /index.php\?ctl=article&id=$2 break; }