我有一個FrontController
期待2個$_GET
PARAMS:
controller
action
到現場一個典型的呼叫看起來像這樣:
我想什麼做的是讓用戶通過以下網址訪問本網站:
我已經試過什麼:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.+)/(.+)$ index.php?controller=$1&action=$2 [L,QSA]
</IfModule>
因爲這給了我404錯誤似乎並沒有工作。
mod_rewrite
本身已在服務器上啓用。
本身並不是答案,但已經有很多框架。使用一個。例如Symfony2。 – PorridgeBear
你在哪裏放置了重寫規則 - httpd.conf或。htaccess的?如果它在.htaccess文件中,那麼哪一個?根目錄內的文件夾或子文件夾內的某個文件夾? –
.htaccess,在子文件夾中。 整個項目位於一個子文件夾中,所以真實世界的URL看起來像這樣:http://foo.bar/project – iceteea