如何使用 .htaccess 将域路径重定向到其他域路径?
How to redirect domain path to other domain path using .htaccess?
下面的域只是示例域。
我想将 mydomain.com/test/(通配符)重定向到 google.com/dl(通配符)
我正在使用这个代码
RewriteEngine on
RedirectMatch 301 ^/test/.*$ https://google.com/dl
但是当我访问https://example.com/test/hi it redirects to https://google.com/dl , instead of https://google.com/dl/hi
我该怎么做?谢谢
能否请您尝试以下,使用显示的示例编写。请确保在测试您的 URL 之前清除您的浏览器缓存。
RewriteEngine on
RewriteRule ^test/(.*)/?$ https://google.com/dl/ [R=301,NC,L]
你可以试试,你会找到 100% 的解决方案,你必须在项目的根文件夹.htaccess 文件中添加以下 3 行
RewriteEngine on
RewriteBase /
RewriteRule (.*) http://www.new-domain.com/ [R=301,L][/php]
下面的域只是示例域。 我想将 mydomain.com/test/(通配符)重定向到 google.com/dl(通配符)
我正在使用这个代码
RewriteEngine on
RedirectMatch 301 ^/test/.*$ https://google.com/dl
但是当我访问https://example.com/test/hi it redirects to https://google.com/dl , instead of https://google.com/dl/hi
我该怎么做?谢谢
能否请您尝试以下,使用显示的示例编写。请确保在测试您的 URL 之前清除您的浏览器缓存。
RewriteEngine on
RewriteRule ^test/(.*)/?$ https://google.com/dl/ [R=301,NC,L]
你可以试试,你会找到 100% 的解决方案,你必须在项目的根文件夹.htaccess 文件中添加以下 3 行
RewriteEngine on
RewriteBase /
RewriteRule (.*) http://www.new-domain.com/ [R=301,L][/php]