0
我想知道如何通過網址傳遞幾個(兩個)值作爲一個乾淨的網址。 我以前做過乾淨的網址,但從來沒有多個值,它似乎沒有工作。多個乾淨的網址變量
這是URL看起來像現在:
http://example.com/?user=Username&page=1
這是我希望它看起來像
http://example.com/user/Username/page/1
我試過,我已經看到了這裏其他的答案,但他們沒有爲這筆交易工作。
RewriteEngine On
# Don't match real existing files so CSS, scripts, images aren't rewritten
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# Match the first two groups before/and send them to the query string
RewriteRule ^([^/]+)/([^/]+) index.php?user=$1&page=$2 [L]
謝謝。 :) 我使用的方式。 :)
此外,我仍然可以使用$ _GET與此?我是這麼認爲的,但我也別的地方它說你不能...:d
非常感謝!我試圖測試這一點,但不幸的是,我使用000webhost作爲一個免費的主機,由於某種原因它的htaccess搞亂了:/ – transparent
我得到它的工作。感謝您的幫助! :) – transparent