
我該如何做到這一點,以便當用戶訪問時mydomain.com/test/<any page after this point>
顯示頁面mydomain.com/testhandler/
並且不返回任何錯誤。舉個例子,我有一個系統,我使用 URI 連結到一個包含頁面資訊的 xml 文件,我需要後面的每個部分/test
來連結到它
任何幫助將不勝感激,謝謝。
答案1
在設定中(無論是主 apache 設定或 vhosts 區塊)新增:
RewriteEngine on
RewriteRule "^/test/*" "/testhandler/" [PT]
分別。看:
https://httpd.apache.org/docs/2.4/rewrite/