我已经开始在IIS上托pipe我自己的站点,它以前在Apache上的DreamHost上托pipe,所以我有一个带有重写规则的.htaccess文件,我想将其转换为URL重写模块规则。
# initialize mod_rewrite RewriteEngine on RewriteBase / # remove the www from the url # RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] # RewriteRule ^(.*)$ http://%1/$1 [R=301,L] ### BEGIN GENERATED REWRITE RULES #### RewriteCond %{REQUEST_FILENAME}/index.html -f RewriteRule ^(.*) $1/index.html #### END GENERATED REWRITE RULES #### # listing pages whose names are the same as their enclosing folder's RewriteCond %{REQUEST_FILENAME}/$1.html -f RewriteRule ^([^/]*)/$ %{REQUEST_FILENAME}/$1.html # regular pages RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^.*$ %{REQUEST_FILENAME}.html # set our custom 404 page ErrorDocument 404 /404.html
我正在使用应用程序Hyde生成我的静态网站,所以想尽可能得到这个工作。 我已经尝试导入htaccess但规则似乎没有给出正确的结果。
如果你只想把你的.htaccess转储到你的根文件夹,让IIS服从你的重写规则,那么就有一个名为ISAPI Rewrite的插件。 我们使用付费版本,但免费版本应该只是罚款,如果它只是一个网站。
IIS7重写语法(显然)是完全不同的,我不知道是否有任何工具存在。