Apache 将.htaccess转换为web.config
我正在使用IIS-7,并且正在将一个站点从基于linux和apache的服务器环境迁移过来。我知道web.config的工作与.htaccess相同。我希望将以下行从.htaccess文件转换为web.config文件。我从哪里开始Apache 将.htaccess转换为web.config,apache,.htaccess,iis,web-config,webserver,Apache,.htaccess,Iis,Web Config,Webserver,我正在使用IIS-7,并且正在将一个站点从基于linux和apache的服务器环境迁移过来。我知道web.config的工作与.htaccess相同。我希望将以下行从.htaccess文件转换为web.config文件。我从哪里开始 Options +FollowSymlinks RewriteEngine On RewriteRule ([A-Za-z0-9/_-]+).(jp(e?)g|gif|png)$ thumb.php?src=../../uploads/default/files/$
Options +FollowSymlinks
RewriteEngine On
RewriteRule ([A-Za-z0-9/_-]+).(jp(e?)g|gif|png)$ thumb.php?src=../../uploads/default/files/$1.$2&size=160x90
要将规则从.htaccess转换为web.config,可以使用IISURL重写模块的导入功能:
我也有点担心如果你允许。/../
作为路径,你的thumb.php会有多安全。你能接受我的答案或告诉我如何改进它吗?@DanLee:如果我的答案有用,你能接受和/或投票吗?一年多过去了,除非你给出一些反馈,否则这个帖子对其他读者来说似乎已经被抛弃/无用。因为我不知道web.config规则,我在搜索在线转换器,但你节省了我的时间,多亏了你@AlexanderAbakumov和MS guys.:)
<rewrite>
<rules>
<rule name="Imported Rule 1">
<match url="([A-Za-z0-9/_-]+).(jp(e?)g|gif|png)$" ignoreCase="false" />
<action type="Rewrite" url="thumb.php?src=../../uploads/default/files/{R:1}.{R:2}&size=160x90" appendQueryString="false" />
</rule>
</rules>
</rewrite>