2016-03-28 43 views
0

我最近從Apache服務器移動到Nginx的一個。我甚至沒有意識到事實上,你不能在nginx上使用.htaccess文件,我已經仔細研究了這一點,但是我發現如何將.htaccess文件的規則轉換爲在nginx上可用。如果有人能幫我一點,我會非常感激!Apache .htaccess文件到Nginx conf文件

這裏是我的.htaccess文件:

DirectoryIndex index.php 
Options -MultiViews 

RewriteEngine on 

RewriteCond %{THE_REQUEST} /index\.php\?page=([^\s&]*)[&\s] [NC] 
RewriteRule^/page/%1? [R=302,L] 

RewriteCond %{THE_REQUEST} /index\.php\?regiment=([^\s&]*)[&\s] [NC] 
RewriteRule^/regiment/%1? [R=302,L] 

RewriteCond %{THE_REQUEST} /error\.php\?error=([^\s&]*)[&\s] [NC] 
RewriteRule^/error/%1? [R=302,L] 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 

RewriteRule ^page/([^/]+)/?$ /index.php?page=$1 [L,QSA] 
RewriteRule ^regiment/([^/]+)/?$ /index.php?regiment=$1 [L,QSA] 
RewriteRule ^error/([^/]+)/?$ /error.php?error=$1 [L,QSA] 

ErrorDocument 404 /error.php?error=404 
ErrorDocument 403 /error.php?error=403 

謝謝大家誰提前幫助!

+0

http://winginx.com/en/htaccess? –

回答