我将工作的web.config文件转换为htaccess。
我无法让htaccess文件正常工作。
没有使用htaccess文件
RewriteEngine On
#RULE PRESS RELEASE MOD REWRITE RULE
RewriteRule ^press-release/([a-z0-9_-]+)$ press-release/index.php?pr=$1 [L]
#RULE IDX MODULE REWRITE RULES SEARCH RESULTS PAGE
RewriteRule ^idx/homesforsale/([a-z0-9_-]+)$ idx/index.php?tag=$1 [L]
#RULE IDX MODULE REWRITE RULES PROPERTY PROFILE PAGE
RewriteRule ^idx/([a-z0-9_-]+)-home/([a-z0-9_-]+)-([a-z0-9_-]+)$ idx/index.php?pt=$1&filter=$2&propid=$3 [L]
使用web.config文件
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Press Release Mod Rewrite Rule" stopProcessing="true">
<match url="^press-release/([a-z0-9_-]+)$" />
<action type="Rewrite" url="press-release/index.php?pr={R:1}" />
</rule>
<rule name="IDX Module Rewrite Rules Search Results Page" stopProcessing="true">
<match url="^idx/homesforsale/([a-z0-9_-]+)$" />
<action type="Rewrite" url="idx/index.php?tag={R:1}" />
</rule>
<rule name="IDX Module Rewrite Rules Property Profile Page" stopProcessing="true">
<match url="^idx/([a-z0-9_-]+)-home/([a-z0-9_-]+)-([a-z0-9_-]+)$" />
<action type="Rewrite" url="idx/index.php?pt={R:1}&filter={R:2}&propid={R:3}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
答案 0 :(得分:0)
事实证明,在处理网址时,Windows不区分大小写,但Linux是。
更改最后一条规则以包括工作上限。
#RULE IDX MODULE REWRITE RULES PROPERTY PROFILE PAGE
RewriteRule ^idx/([a-zA-Z0-9_-]+)-home/([a-zA-Z0-9_-]+)-([a-zA-Z0-9]+)$ idx/index.php?pt=$1&filter=$2&propid=$3 [L]