我剛剛開始使用的.htaccess mod_rewrite
我發現自己難倒:如何將index.php重定向到index.php?route = home,並將其重寫爲/ home?
我建立基於查詢字符串加載意見後index.php
的應用程序(使用MVC模式);例如。 domain.com/index.php?route=home
將加載主頁。
然而,這意味着domain.com/index.php
沒有查詢字符串加載任何東西......或更多的加載點,domain.com
加載什麼。
。 。 。
我想什麼,是domain.com
(和domain.com/index.php
)
重定向到domain.com/index.php?route=home
,
,然後有domain.com/index.php?route=home
改寫爲domain.com/home
。
任何幫助,將不勝感激!謝謝。
我試過'RewriteEngine On'然後'RewriteRule /^(.*)/ index.php? route = $ 1 [L]',但在「http:// domain.com/home」中輸入時顯示「在此服務器上未找到請求的URL/home」。我還需要添加一個默認的查詢字符串,而不僅僅是'domain.com/home'重定向。 – jlmakes
用於測試將'[L]'更改爲'[R,L]'並告訴我地址欄上的網址是什麼 – Ibu
RewriteRule ^(。*)index.php?route = $ 1 [L,QSA] this should追加查詢字符串 –