[英]Redirect all urls after replace a part of url htaccess
我正在將php腳本從一個服務器目錄遷移到另一個目錄。 我試圖為此編寫一個htaccess規則。 當前網址如下
EX-
https://www.example.com/scripts/tracking/inex.php
https://www.example.com/scripts/tracking/agency/invoice.php
https://www.example.com/scripts/tracking/admin/manage.php
新的新網址就像
EX-
https://www.example.com/dashboard/index.php
https://www.example.com/dashboard/agency/invoice.php
https://www.example.com/dashboard/admin/manage.php
上面有很多網址,因此很難對每個網址進行一對一重定向。
無論如何,有沒有用儀表板替換腳本/跟蹤部分並重定向到替換的URL。
我用這個但是似乎不起作用
RedirectMatch 301 /scripts/tracking(.*) /dashboard/$1
有人幫我寫這個,謝謝
RedirectMatch permanent "^scripts/tracking/(.*)" "/dashboard/$1"
您需要mod_alias才能正常工作。
RewriteEngine on
RewriteRule ^scripts/tracking/(.*) /dashboard/$1 [L,R=301]
您需要mod_rewrite才能正常工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.