你好我试图在nginx上设置韭菜,有人可以帮我转换htaccess吗?
Options +FollowSymLinks
IndexIgnore */*
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php?__chive_rewrite_on=1&%{QUERY_STRING}
RewriteRule ^$ index.php?__chive_rewrite_on=1&%{QUERY_STRING}
</IfModule>
Run Code Online (Sandbox Code Playgroud)
小智 6
如果您在一个子目录"chive"中安装了chive,请执行以下操作:
location /chive/ {
try_files $uri chive/$uri/ /chive/index.php?q=$uri&$args;
}
Run Code Online (Sandbox Code Playgroud)
没有子目录:
location / {
# ... existing options ... check twice!
try_files $uri $uri/ /index.php?q=$uri&$args;
}
Run Code Online (Sandbox Code Playgroud)
根据http://wiki.nginx.org/HttpCoreModule(而不是$ args,除了这个变量是readonly.),而不是$ args你可以使用$ query_string .