[英].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.