开发者

How do I get my php websites using .htaccess files to do basic URL re-writing to work on new windows server?

I have just bought a new Windows server with IIS on it and plesk panel. Good times (I thought...)

I have about 10 client sites that run on PHP which shouldn't be a problem. But I can't seem to get an answer from my hosting provider on how to get my .htaccess working on the windows server so I'm getting stung for two lots of hosting and don't know the best way forward.

How do i get my .htaccess rewriting working on windows?

EDIT I have installed the IIS version 2 of their rewrite module and tried to convert my .htaccess file into a web.config set of rules.

Now my very basic site which uses the zend framework shows a 404 for the homepage (90% of the time) and the other pages to display the site but they all show the homepage.

Any ideas or has anyone had similar problems?

Will post the rules I'm using shortly and the old .htaccess file that used to work.

.htaccess file from linux setup

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
Rewri开发者_如何学GoteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

Windows version

<rewrite>
  <rules>
    <rule name="Imported Rule 1" stopProcessing="true">
      <match url="^.*$" />
      <conditions logicalGrouping="MatchAny">
        <add input="{REQUEST_FILENAME}" matchType="IsFile"  />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory"  />
      </conditions>
      <action type="None" />
    </rule>
    <rule name="Imported Rule 2" stopProcessing="true">
      <match url="^.*$" />
      <action type="Rewrite" url="index.php" />
    </rule>
  </rules>
</rewrite>


.htaccess files are specific to the Apache web server. They're not going to do a thing on IIS.

You'll need to convert them to a format IIS understands. Here's a tutorial.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜