小白一个,请教大神帮忙转换下 apache 配置,感谢!

2016-09-25 14:22:43 +08:00
 886106
因为对 nginx 不了解,希望有大大帮忙下感谢~

RewriteEngine On
RewriteBase /cp
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9a-zA-Z]+)$ /index.php?type=$1 [L]
RewriteRule ^([0-9a-zA-Z]+)/(\w+)$ /index.php?type=$1&web=$2 [L]
RewriteRule ^([0-9a-zA-Z]+)/(\w+)/(\w+)$ /index.php?type=$1&web=$2&page=$3 [L]
RewriteRule ^([0-9a-zA-Z]+)/(\w+)/(\w+)/(\w+)$ /index.php?type=$1&web=$2&page=$3&pid=$4 [L]
Options -Indexes
2943 次点击
所在节点    NGINX
5 条回复
lhbc
2016-09-25 15:01:00 +08:00
这是什么程序?
目测这代码有好多年了,估计搜一下就有。
sherlocktheplant
2016-09-25 15:02:57 +08:00
nginx 原生支持.htdoc
Kokororin
2016-09-25 15:11:53 +08:00
Dirlllee
2016-09-25 19:14:32 +08:00
首先百度
lslqtz
2016-09-26 18:06:21 +08:00
@Kokororin 来自他提供的链接的结果,似乎很 ok 。感谢+1

location /cp/ {
if (!-e $request_filename){
rewrite ^/cp/([0-9a-zA-Z]+)$ /cp/index.php?type=$1 break;
}
rewrite ^/cp/([0-9a-zA-Z]+)/(\w+)$ /cp/index.php?type=$1&web=$2 break;
rewrite ^/cp/([0-9a-zA-Z]+)/(\w+)/(\w+)$ /cp/index.php?type=$1&web=$2&page=$3 break;
rewrite ^/cp/([0-9a-zA-Z]+)/(\w+)/(\w+)/(\w+)$ /cp/index.php?type=$1&web=$2&page=$3&pid=$4 break;
}

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/308829

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX