[英]Redirect all urls after replace a part of url htaccess
I'm migrating a php script to one server directory to another directory. 我正在将php脚本从一个服务器目录迁移到另一个目录。 I tried to write a htaccess rule for that.
我试图为此编写一个htaccess规则。 the current urls are like below
当前网址如下
Ex- 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
The new new urls are like 新的新网址就像
Ex- EX-
https://www.example.com/dashboard/index.php
https://www.example.com/dashboard/agency/invoice.php
https://www.example.com/dashboard/admin/manage.php
There have lot of urls like above so it's difficult to write one to one redirects to each urls. 上面有很多网址,因此很难对每个网址进行一对一重定向。
is there anyway to replace scripts/tracking part with dashboard and redirect to replaced url. 无论如何,有没有用仪表板替换脚本/跟踪部分并重定向到替换的URL。
I used this but seems not working 我用这个但是似乎不起作用
RedirectMatch 301 /scripts/tracking(.*) /dashboard/$1
Anyone help me to write this, Thank You 有人帮我写这个,谢谢
RedirectMatch permanent "^scripts/tracking/(.*)" "/dashboard/$1"
您需要mod_alias才能正常工作。
RewriteEngine on
RewriteRule ^scripts/tracking/(.*) /dashboard/$1 [L,R=301]
You need mod_rewrite for this to work. 您需要mod_rewrite才能正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.