[英]Convert directory htaccess code in to statement for nginx conf file
[英]Apache .htaccess file to Nginx conf file
我最近已从Apache服务器移至Nginx服务器。 我什至没有意识到您一开始不能在nginx上使用.htaccess文件,我对此进行了一些研究,但是我发现如何将.htaccess文件的规则转换为它非常混乱在nginx上可用。 如果有人可以帮助我一点,我将非常感激!
这是我的.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
感谢提前提供帮助的每个人!
我正在使用网站进行转换: http : //www.winginx.com/cn/htaccess
也为您工作?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.