简体   繁体   English

mod重写为IIS重写规则

[英]mod rewrite to IIS rewrite rule

I have a rule in my .htaccess which is 我的.htaccess中有一条规则是

RewriteRule ^([a-zA-Z0-9-_]+)$ listing-search.php?profile=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME}\.php -f

It basically looks for profile names after the domain (http://mysite.com/19KAREN) and extracts the profile details. 它基本上在域(http://mysite.com/19KAREN)之后查找配置文件名称,并提取配置文件详细信息。 I have tried to convert this to IIS7 rewrite using the available rewrite module and for the most part of it it works great however I have a blog at http://mysite.com/blog and when using the htaccess rewrite the blog is displayed (correct) however in IIS it is trying to fetch a profile named blog (incorrect). 我试图使用可用的重写模块将其转换为IIS7重写,并且它在大多数情况下都很好用,但是我在http://mysite.com/blog上有一个博客,当使用htaccess重写时,会显示该博客(正确),但是在IIS中,它试图获取名为Blog的配置文件(不正确)。

If I were to add a slash to the end of the URL (http://mysite.com/blog/) then it works but I believe the client has sent out collateral without the slash so this isn't really an option. 如果我要在URL(http://mysite.com/blog/)的末尾添加一个斜杠,那么它可以工作,但是我相信客户端已发出没有斜杠的抵押品,因此这不是一种选择。

I have tried adding a new rule to rewrite http://mysite.com/blog to .../blog/ but that isn't working either. 我曾尝试添加新规则以将http://mysite.com/blog重写为... / blog /,但这都不起作用。

Any suggestions? 有什么建议么?

Worked it out. 解决了。 Added a condition to the rule that if it's not a directory. 为规则添加了条件,如果它不是目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM