Php Magento htaccess重定向问题
我试图将一个特定的URL及其所有子URL重定向到一个特定的URL。使用301重定向可以正常工作,但浏览器URL也显示测试内容。请参阅下文了解更多详细信息 示例:Php Magento htaccess重定向问题,php,.htaccess,magento,redirect,mod-rewrite,Php,.htaccess,Magento,Redirect,Mod Rewrite,我试图将一个特定的URL及其所有子URL重定向到一个特定的URL。使用301重定向可以正常工作,但浏览器URL也显示测试内容。请参阅下文了解更多详细信息 示例:https://www.mywebsite.com/customer/account/login/referer/*需要重定向到https://www.mywebsite.com/customer/account/login/register 我尝试的是: Options +FollowSymLinks RewriteEngine on
https://www.mywebsite.com/customer/account/login/referer/*
需要重定向到https://www.mywebsite.com/customer/account/login/register
我尝试的是:
Options +FollowSymLinks
RewriteEngine on
Redirect 301 /customer/account/login/referer https://mywebsite.com/customer/account/login/register
htaccess规则仅适用于此URL。如果我打字
https://mywebsite.com/customer/account/login/referer/testing
这将被重定向到https://mywebsite.com/customer/account/login/register/test
请让我知道如何从重定向的URL中修剪其他部分(注册后的URL部分/*)。我想要达到的是
https://mywebsite.com/customer/account/login/referer/*
[在referer/(包括/referer)之后的任何URL都需要重定向到https://mywebsite.com/customer/account/login/register
].这是预期的行为,如
然后,以URL路径开头的任何请求都将向目标URL所在位置的客户端返回重定向请求匹配URL路径之外的其他路径信息将附加到目标URL。
要将以该前缀开头的所有请求重定向到给定的URL,可以使用,它使用正则表达式而不是URL前缀
RedirectMatch ^/customer/account/login/referer https://mywebsite.com/customer/account/login/register
你不需要使用
Options +FollowSymLinks
RewriteEngine on
因为这是为了修改<代码>重定向和
重定向匹配
由mod_alias模块提供。谢谢Olaf。这很有效。这正是我想要达到的。现在所有的URL都根据请求重定向。也谢谢你的详细解释。