1
我的網址,我想訪問不同:多個GET PARAMS
原文:mywebsite.com/index.php?page=index
新:mywebsite.com/index
我做與此的.htaccess:
RewriteEngine on
# The two lines below allow access to existing files on your server, bypassing
# the rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?page=$1 [QSA]
下一URL(從指數掛鉤):
原文:mywebsite.com/index.php?page=hotel &酒店= 5
新:mywebsite.com/hotel/5
我發現有關多PARAMS一些信息,但我不能讓他們上班。
作品,謝謝。你介意解釋「RewriteBase /」和「RewriteRule^- [L]」嗎? – PrimuS 2014-11-25 11:35:22
'RewriteBase /'是可選的,但在這裏很好。 'RewriteBase'基本上從.htaccess的當前目錄設置文件的路徑。 'RewriteRule^- [L]'表示對於上述條件「無所作爲」,即如果請求是針對文件/目錄,則忽略其餘規則。 – anubhava 2014-11-25 11:37:21
現在我想用第三個參數「擴展」規則,現在不行,你能告訴我爲什麼嗎? 'RewriteRule ^([^ /] +)/([^ /] +)/?$ index.php?page = $ 1&hotel = $ 2&vars = $ 3 [L,QSA]' – PrimuS 2014-11-26 10:33:23