[英].htaccess RewriteRule issue, some rules not working
我有一个带有一些规则的大型.htaccess
文件。 其中一个规则不起作用,我不知道为什么。
我检查了该文件: http://www.htaccesscheck.com并且没有问题。
我的php
文件中有 2 个链接:
echo '<a href="corten-stalen-borderrand-hoek-type-'.$_GET['type'].'-03'">Bestel op maat</a>
echo '<a href="corten-stalen-borderrand-hoek-getrapt-type-'.$_GET['type'].'-04'">Bestel op maat</a>
在我的.htaccess
我有:
RewriteRule ^corten-stalen-borderrand-([A-Za-z0-9-]+)-type-([A-Za-z0-9-]+)-([A-Za-z0-9-]+)$ product_borderrand_hoek.php?type=$2&id=$1&image=$3
RewriteRule ^corten-stalen-borderrand-([A-Za-z0-9-]+)-getrapt-type-([A-Za-z0-9-]+)-([A-Za-z0-9-]+)$ product_borderrand_hoek_getrapt.php?type=$2&id=$1&image=$3
.htaccess
中的第二行不工作。 有什么建议么?
下面带有绿色框的图像工作正常,红色不工作正常。 应该指向: https://torza.nl/test_environment/metaalboutique/nieuwe_versie/product_borderrand_hoek_getrapt.php?type=1&id=hoek&image=04
我认为问题在于您提出的第一条规则; 如果我理解正确的话,它也匹配应该根据第二条规则重写的第二个 URL。 为避免这种情况,您必须将第一条规则调整为不包括-
在第一个字符组中
RewriteRule ^corten-stalen-borderrand-([A-Za-z0-9]+)-type-([A-Za-z0-9-]+)-([A-Za-z0-9-]+)$ product_borderrand_hoek.php?type=$2&id=$1&image=$3
或者,如果这不可能,请防止getrapt
在type
之前出现: ([A-Za-z0-9-]+)(?<!getrapt)-type
^corten-stalen-borderrand-([A-Za-z0-9-]+)(?<!getrapt)-type-([A-Za-z0-9-]+)-([A-Za-z0-9-]+)$
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.