2016-12-30 86 views
0

我掙扎如何設置的.htaccess用於獲取以下網址PARAMATERS:重寫規則參數

RewriteEngine on 
RewriteBase/
RewriteRule ^search/([^/\.]+)/?$ /search/index.html?q=$1 [L,NC,QSA] 

所以,我們的目標是,當網址是:mydomain.com/search/some +在搜索目錄中查詢index.html可以獲得「some + query」作爲參數。

有什麼想法?

+0

[請參考以下鏈接,並嘗試(http://stackoverflow.com/questions/18445785/how-to-htaccess-rewrite-the-url-of -a特定的搜索查詢) – sasikaran

回答

0

試試這個根目錄下,

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^search/([\w-]+)$ /search/index.html?q=$1 [QSA,NC,l]