全球主机交流论坛

标题: apache规则 转 nginx规则50金币求解,就一行 [打印本页]

作者: 分享吧    时间: 2013-12-18 20:21
标题: apache规则 转 nginx规则50金币求解,就一行
这是apache的。

  1. <IfModule mod_rewrite.c>
  2.    RewriteEngine on
  3.    RewriteOptions MaxRedirects=1
  4.    RewriteBase /
  5.    RewriteCond %{REQUEST_FILENAME} !-f
  6.    RewriteCond %{REQUEST_FILENAME} !-d
  7.    RewriteCond %{REQUEST_FILENAME} !-l
  8.    RewriteRule ^([a-zA-Z0-9_-].+)$ index.php?p=$1 [L]
  9. </IfModule>
复制代码


看一些网上介绍, 自己转的,但还是404...

  1. location / {
  2.            rewrite ^([0-9].html)$ /index.php?p=$1 last;
  3.         }
复制代码

作者: 田总    时间: 2013-12-18 20:21

  1. location / {
  2.            rewrite ^/([a-zA-Z0-9_-].+)$ /index.php?p=$1 last;
  3.         }
复制代码

作者: a77742368    时间: 2013-12-18 20:26
楼下请解答
作者: ericls    时间: 2013-12-18 20:29
试试
rewrite  ^(.*)$  /index.php?p=$1  last;
break;
作者: 分享吧    时间: 2013-12-18 20:35
ericls 发表于 2013-12-18 20:29
试试
rewrite  ^(.*)$  /index.php?p=$1  last;
break;

不出现 404了,  但是内容无法显示/首页内容页不显示。。。

p=数字,  都是固定的。   xxx.com/数字.html
作者: android    时间: 2013-12-18 20:36
这是什么程序的,上次有一个相同的
作者: ericls    时间: 2013-12-18 20:44
本帖最后由 ericls 于 2013-12-18 20:45 编辑

rewrite  ^(\d+\.html)$  /index.php?p=$1  last;




欢迎光临 全球主机交流论坛 (https://hostloc-workers.ikyomon.com/) Powered by Discuz! X3.4