[英]Magento htaccess redirection issue
我试图将特定的URL及其所有子URL重定向到特定的URL。 使用301重定向可以正常工作,但浏览器URL也会显示测试内容。 请参阅以下详细信息
示例: https://www.mywebsite.com/customer/account/login/referer/*
: 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/*
[任何URL的AFTER Referer /(包括/ referer)都需要重定向到https://mywebsite.com/customer/account/login/register
]。
如Redirect
文档中所述,这是预期的行为
然后,任何以URL-Path开头的请求都将在目标URL的位置向客户端返回重定向请求。 匹配的URL-Path之外的其他路径信息将附加到目标URL。
要将所有以该前缀开头的请求重定向到给定的URL,可以使用RedirectMatch
,它使用正则表达式代替URL前缀
RedirectMatch ^/customer/account/login/referer https://mywebsite.com/customer/account/login/register
你不需要用
Options +FollowSymLinks
RewriteEngine on
因为这是针对mod_rewrite的。 Redirect
和RedirectMatch
由mod_alias模块提供。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.