Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 普通URL被重定向的301重写规则替换_Php_Regex_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Php 普通URL被重定向的301重写规则替换

Php 普通URL被重定向的301重写规则替换,php,regex,apache,.htaccess,mod-rewrite,Php,Regex,Apache,.htaccess,Mod Rewrite,我有一个名为local.maalumalu的虚拟主机。htaccess中有很多301重定向规则。我的问题是当我有这样的规则时 重定向301/special offers local.maalumalau/special-offers.html 然后 local.maalumalau/special-offers/free-child.html 被重定向到 local.maalumalau/special-offers.htmlfree-child.html 即“找不到页面”。有什么建议吗 使用重

我有一个名为local.maalumalu的虚拟主机。htaccess中有很多301重定向规则。我的问题是当我有这样的规则时

重定向301/special offers local.maalumalau/special-offers.html

然后

local.maalumalau/special-offers/free-child.html

被重定向到

local.maalumalau/special-offers.htmlfree-child.html


即“找不到页面”。有什么建议吗

使用
重定向匹配
而不是
重定向
<代码>重定向匹配具有
regex
支持:

RedirectMatch 301 ^/special-offers/?$ local.maalumaalu/special-offers.html
或者,如果要使用mod_rewrite,则:

RewriteEngine On
RewriteRule ^special-offers/?$ /local.maalumaalu/special-offers.html [L,R=301,NC]