nginx、htaccess 上的韭菜

发布于 2024-10-02 17:03:25 字数 531 浏览 0 评论 0原文

你好,我正在尝试在 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>

Hello there im trying to setup chive on nginx, can someone help me convert htaccess for it ?

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

乖乖 2024-10-09 17:03:25

如果您将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;
}

您可以使用$query_string代替$args,根据http ://wiki.nginx.org/HttpCoreModule(内容为:“与 $args 相同,只是该变量是只读的。”)

In case you installed chive in a subdirectory "chive" do the following:

location /chive/ {
        try_files $uri chive/$uri/ /chive/index.php?q=$uri&$args;
}

without a subdir:

location / {
# ... existing options ... check twice!
        try_files $uri $uri/ /index.php?q=$uri&$args;
}

instead of $args you could use $query_string, according to http://wiki.nginx.org/HttpCoreModule (It reads: "The same as $args except that this variable is readonly.")

楠木可依 2024-10-09 17:03:25

从那时起伟大的项目就出现了
https://github.com/perusio/chive-nginx

Great project appeared since then
https://github.com/perusio/chive-nginx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文