您好:我需要帮助将我的IIS重写规则转换为.htaccess文件。 我对服务器规则不是很熟悉(我主要是设计和开发网站)。 我需要一些帮助。我目前正在将一个网站(dolyn.com)从另一个服务器移到我们的网站,他们最初使用WIMP设置启动它,因此使用来自IIS(web.config)的URL重写而不是来自Apache(.htacces)的mod_rewrite模块[我真的不太清楚它的物流 - 我刚刚被要求确保它在我们的服务器上运行。这里是原来的web.config文件:将web.config转换为.htaccess
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<!-- Doesn't work on DEV servers, uncomment it on live site -->
<!-- httpErrors errorMode="Detailed" /-->
<rewrite>
<rules>
<clear />
<!--
This rule will redirect all requests to a single main domain as specified in the 1st condition, except if it's on a baytek dev site.
Instructions:
1. Enable the rule
2. Change "^www.maindomain.com$" to real domain, ex. "^www.bayteksystems.com$", in both places.
-->
<rule name="Redirect to WWW" stopProcessing="true" enabled="false">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^www.maindomain.com$" negate="true" />
<add input="{HTTP_HOST}" pattern="dev.bayteksystems.com$" negate="true" />
</conditions>
<action type="Redirect" url="http://www.maindomain.com/{ToLower:{R:0}}" redirectType="Permanent" />
</rule>
<rule name="Add trailing slash" stopProcessing="true">
<match url="(.*[^/])$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" url="{ToLower:{R:1}}/" redirectType="Permanent" />
</rule>
<rule name="Convert to lower case" stopProcessing="true">
<match url=".*[A-Z].*" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" url="{ToLower:{R:0}}" redirectType="Permanent" />
</rule>
<rule name="DynamicURLs" enabled="true" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{URL}" pattern="^_cms.*" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?page={R:1}&url_rewrite=true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
我已经做了相当多的研究,它看起来像我可能还需要一个htpasswd文件?它是否正确?正如你可以从web.config服务器它来自baytechsystems.com,我们将它移动到dnsnetworks.ca
它看起来像它的重定向到www.dylon.com - 我想要的是它在web01.dnsnetworks.ca/dolyn(这是所有文件都是... index.php).. – user3112402
当我尝试加载网站...。这是什么弹出到错误日志中; (/_erl/share/php/index.php)//usr/share/php中的/app/website/doly/_includes/common.php错误:require_once():开启所需的'/app/website/doly/_includes/common.php'第13行的app/website/dolyn/index.php 我想我错过了服务器上的php-devel库,因为它试图使用php的php-pear扩展。 它不是一个简单的安装,因为我运行的是PHP的最新版本,而我的系统的开发库尚不可用。你认为@JonLin – user3112402
@ user3112402有很多各种各样的PHP库,它们都没有安装最少的PHP,LOTS。但是你应该确保'/ app/website/doly/_includes/common.php'存在 –