被 nginx 伪静态搞疯了,,

2017-06-16 15:45:19 +08:00
 s609926202

网站只提供了.htaccess,但是服务器是 nginx serve,所以要 convert, 一下是.htaccess 内容:

RewriteEngine On RewriteBase / RewriteRule ^(uploads/.?_\d+x\d+.(jpg|gif|png|jpeg))$ /image/index.php?$1 [L] <Files .> Order Deny,Allow Deny From All </files> RewriteRule ^(?:v5|modules|system)\b.* index.php/$0 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !^/(uploads|public|newtravel|phone|payment)(/)? RewriteRule .* index.php/$0 [PT]

求助懂得 Nginx rewrite 的给出 convert 后的配置

1362 次点击
所在节点    问与答
2 条回复
s609926202
2017-06-16 15:45:31 +08:00
# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /
#mobile start
#mobile end
RewriteRule ^(uploads/.*?_\d+x\d+\.(jpg|gif|png|jpeg))$ /image/index.php?$1 [L]

# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>


# Protect application and system files from being viewed
RewriteRule ^(?:v5|modules|system)\b.* index.php/$0 [L]

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/(uploads|public|newtravel|phone|payment)(/)?
#RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]
ahu
2017-06-16 15:47:50 +08:00

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

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

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

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

© 2021 V2EX