Php .htaccess重写规则问题,某些规则不起作用
我有一个带有一些规则的大Php .htaccess重写规则问题,某些规则不起作用,php,.htaccess,Php,.htaccess,我有一个带有一些规则的大.htaccess文件。其中一条规则不起作用,我不知道为什么 我检查过的文件:没有问题 我的php文件中有两个链接: echo '<a href="corten-stalen-borderrand-hoek-type-'.$_GET['type'].'-03'">Bestel op maat</a> echo '<a href="corten-stalen-borderrand-hoek-getrapt-type
.htaccess
文件。其中一条规则不起作用,我不知道为什么
我检查过的文件:没有问题
我的php
文件中有两个链接:
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
中的第二行不工作。有什么建议吗
这是关于以下内容的页面:
下图中的geen框工作正常,红色为not working OK。
应指出:
我认为问题是你提出的第一条规则;它还匹配第二个URL,如果我理解正确的话,应该根据第二条规则重写该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
在类型之前显示:([A-Za-z0-9-]+)(
^corten stalen borderrand-([A-Za-z0-9-]+)(?为了更好地理解您的问题,请确实提及您在浏览器中访问的URL以及您希望在后端为其提供服务的URL。感谢您向我指出匹配这两个规则的问题。我在.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
^corten-stalen-borderrand-([A-Za-z0-9-]+)(?<!getrapt)-type-([A-Za-z0-9-]+)-([A-Za-z0-9-]+)$