2016-05-17 29 views
0

我使用MVC模式在PHP和重寫URL是這樣的:如何使用GET方法時,URL在MVC(PHP)改寫

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-f 

RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule ^(.*)$ index.php?url=$1 [PT,L] 

現在的問題是我想使用$_GET方法,當我在使用?後,此字符未顯示例如:

http://localhost/site/register/?Authority=716&Status=NOK 

現在的結果後改寫爲:網站/註冊/

我想將所有鏈接的使用:

$Authority = $_GET['Authority']; 
$Status= $_GET['Status']; 

回答

0

修復重寫規則

RewriteRule ^(.*)$ index.php?url=$1 [PT,L, QSA] 

的QS標誌告訴apache追加現有的查詢字符串。

看到https://httpd.apache.org/docs/current/en/rewrite/flags.html#flag_qsa

+0

謝謝,但它確實有些結果還沒有:(。你的意思是'重寫規則^(。*)$的index.php?URL = $ 1 [PT,L,QSA]'? – Amin

+0

是確實,你有權利 –

+0

你有什麼建議@ mh-cbon? – Amin