您好:我需要幫助將我的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'存在 –