2
繼接受這個post的答案後,我構建了一個非常簡單的重寫規則,但似乎沒有按照設計工作。Apache重寫 - 虛擬目錄到php腳本
# /st doesn't exist, it's virtual
example.com/st/sometext
重寫爲
# /app is a symlink to /app.php, and this link works if entered directly
example.com/app/st/sometext
而重寫規則:
RewriteRule ^st/(.*)$ app/st/$1 [L]
這條規則是在重寫塊的頂部,之後還有其他的規則,但這些規則不該由於[L]限制,不適用。
重寫日誌文件中有這樣的:
(2) init rewrite engine with requested uri /st/sometext
(1) pass through /st/sometext
它似乎並不像重寫規則匹配的URL。我錯過了什麼?
location /st {
rewrite ^/st/(.*)$ /app.php/st/$1 last;
}
nginx的確實有一點做與重寫規則,更多的是得到切換:
你的解釋和你的規則正好相反。你的規則意味着'重寫st/XXX到app/st/XXX'這不是你在問題開始時所說的 – 2014-10-01 09:08:36
@JustinIurman:Thx,已更新。 – 2014-10-01 15:55:07