0
我想掩蓋URL http://example.com/index.php?path=controller/function
到http://example.com/controller/function
。不需要存在function
。重新路由URL參數路徑
我該如何用htaccess文件做到這一點?
以下不起作用。
RewriteRule ^/?assets/(.*)$ assets/$1 [L] # directory for CSS, images, and JavaScript
RewriteRule ^$ /index [redirect]
RewriteRule ^([a-zA-Z]+)/?([a-zA-Z/]*)$ index.php?path=$1/$2 [L]
目前,如果我在瀏覽器中輸入http://example.com/controller/function
,我收到一個404錯誤,但進入http://example.com/index.php?path=controller/function
作品。
謝謝!
它的工作!非常感謝你。 –
如果您需要將'http:// example.com/uploads/var1/var2/file.txt'重寫爲'http://example.com/index.php?filepath = var1/var2/file.txt' ? –