韭菜在 nginx,htaccess
Posted
技术标签:
【中文标题】韭菜在 nginx,htaccess【英文标题】:chive on nginx, htaccess 【发布时间】:2011-05-11 07:00:29 【问题描述】:您好,我正在尝试在 nginx 上设置 chive,有人可以帮我转换 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>
【问题讨论】:
【参考方案1】:如果您在子目录“chive”中安装了 chive,请执行以下操作:
location /chive/
try_files $uri chive/$uri/ /chive/index.php?q=$uri&$args;
没有子目录:
location /
# ... existing options ... check twice!
try_files $uri $uri/ /index.php?q=$uri&$args;
根据http://wiki.nginx.org/HttpCoreModule,您可以使用$query_string 来代替$args(上面写着:“与$args 相同,只是该变量是只读的。”)
【讨论】:
【参考方案2】:从那时起伟大的项目出现了https://github.com/perusio/chive-nginx
【讨论】:
以上是关于韭菜在 nginx,htaccess的主要内容,如果未能解决你的问题,请参考以下文章