Mod_rewrite for IIS - iis

Is there anything similar to mod_rewrite for IIS 6/7? I want to be able to point several domains (I'm guessing using CNAMEs) to one domain "abc.com", and then do a redirect to "abc.com/start.html" once the browser hits that domain.

The more advanced tool is ISAPI Rewrite (there is free and paid versions)
http://www.isapirewrite.com/
It allows you setting almost all kinds of rules which mod_rewrite can do.

We use the Ionics ISAPI Rewriter. It's configuration is a subset of what is available with Apache's mod_rewrite.

If you're using ASP.NET, URLRewriting.net is good and open source.

Helicon Ape is a product that emulates Apache behavior on IIS7.
For IIS6 ISAPI_Rewrite 3 is the tool that does the job of Apache mod-rewrite

http://www.iis.net/extensions/URLRewrite/ will work for IIS 7 (it doesn't and won't work for IIS 6). It has a Administration UI and was designed for IIS 7.

Related

Is It Possible To Perform A SQL Database Query As Part Of A WebConfig URL Rewrite Rule?

I'm currently in the process of migrating a PHP website from LAMP Hosting to Microsoft Azure Web Apps Hosting.
The site being migrated uses HTAccess for URL Rewriting purposes; however from what I can tell, Azure does not support the use of HTAccess files (please correct me if I am wrong in this) - instead, it appears that I must use IIS WebConfig for this purposes (a technology that I am not overly familiar with).
Assuming that I have to rewrite the file from HTAccess to WebConfig, the HTAccess file to be rewritten uses Mod_Rewrite and external Rewrite Maps as part of the URL rewriting process. The HTAccess Rewrite Map performs a Database Query as part of this process whereby a URL such as www.example.com/category/music is inputted and then re-written to www.example.com/category.php?catID=1, i.e. the ID associated with each category name is identified via a Database query.
I've familiarised myself with the basics of Web Config and IIS Rewrite Maps thus far; however I have only encountered tutorials outlining static rewrite rules.
Is it possible to perform database queries using IIS Config - similar to the HT Access scenario outlined above?
If so, can someone please point me in the direction of some tutorials dealing with the topic or provide some sample code.
Any help is much appreciated.
Found a tutorial that deals this topic here.
Not sure if that article answers your question but the right way would be using IIS manager on a windows machine to convert from mod rewite rules to urlrewrite config as detailed in https://www.iis.net/learn/extensions/url-rewrite-module/importing-apache-modrewrite-rules

How do I rewrite a URL in IIS?

What would be simplest way to get this functionality in my website. A small example code will be appreciated.
Microsoft provide a free URL rewriter you can install on IIS7:
IIS UrlRewrite (IIS.NET)
There's even a nice video introduction to using it.

Is it possible to do friendly url (url rewriting) in classic asp?

I know how to create/implement friendly url in asp.net, but is it possible (and if so - how) to do it in classic asp?
if its impossible, how would google respond (SEO) to creating pages whos sole purpose is to redirect (on load) to a different page?
thanks!
Use a URL rewriter like IIRF or IsapiRewrite that ties into IIS and is processed before ASP/ASP.NET/PHP get the request.
If your classic ASP application runs on a IIS7 then I would totally suggest creating a web.config and using ASP.NET url rewriting feature. I use that for my projects and it works perfectly!
If it runs on an older IIS then ISAPIRewrite or IIRF. Nevertheless I would try as hard as possible to upgrade to IIS7 as it will make things so much easier.
You can also do it without a Rewrite Filter using a custom 404 page. In that you can use Server.Transfer or Server.Execute to redirect off to the correct page. Trouble is you loose your QueryString object doing it that way but it sort of works with a little love and cuddling.
If you want to avoid Server.Transfer et al you can also wrap all your templates in objects and included them all and just call a render function on the template you want to render, leads to big code over-head but its easily overcome by modern server brute force power!
In IIS 7 use Microsoft's own free URL Rewrite!
You need an ISAPI module. It's quite a bit more complex than URL rewriting in ASP.NET, so you can try a commercial rewriter like this one.
Or you can try the Ionic's Isapi Rewrite Filter, which is free, at http://www.codeplex.com/IIRF
IsapiRewrite, yes, I agree with that recommendation.
To answer your other question, Google won't care, just 301 redirect them. Make sure you don't have duplicate content, and don't even 302 redirect. If you 301 redirect, the Google should keep your PageRank concentrated on a single page. (This is what the SEO gurus at work tell me.)
ISAPI_Rewrite v3 will satisfy your needs. There a friendly manager and quite an easy syntax (well anyway if you encounter problems, you may address their support forum).

.htaccess or .htpasswd equivalent on IIS?

Does anyone know if there is an equivalent to .htaccess and .htpassword for IIS ? I am being asked to migrate an app to IIS that uses .htaccess to control access to sets of files in various URLs based on the contents of .htaccess files.
I did a google search and didn't turn up anything conclusive. Is there a general approach or tool that I need to purchase that provides this capability ?
For .htaccess rewrite:
http://learn.iis.net/page.aspx/557/translate-htaccess-content-to-iis-webconfig/
Or try aping .htaccess:
http://www.helicontech.com/ape/
There isn't a direct 1:1 equivalent.
You can password protect a folder or file using file system permissions. If you are using ASP.Net you can also use some of its built in functions to protect various urls.
If you are trying to port .htaccess files used for url rewriting, check out ISAPI Rewrite: http://www.isapirewrite.com/
I've never used it but Trilead, a free ISAPI filter which enables .htaccess based control, looks like what you want.
This is the documentation that you want:
http://msdn.microsoft.com/en-us/library/aa292114(VS.71).aspx
I guess the answer is, yes, there is an equivalent that will accomplish the same thing, integrated with Windows security.

mod_rewrite equivalent for IIS 7.0 [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Is there a mod_rewrite equivalent for IIS 7.0 that's
a) more or less complete
b) suitable for a production environment, i.e. battle-tested/dependable/secure
Do you have an experience-based recommendation?
Check out the URL Rewrite Module for IIS 7 created by Microsoft
If you have $99.00 to spare you may want to take a look at http://www.isapirewrite.com/
[Excerpt from thier website]
Product overview
ISAPI_Rewrite is a powerful URL manipulation engine based on regular expressions. It acts mostly like Apache's mod_Rewrite, but is designed specifically for Microsoft's Internet Information Server (IIS). ISAPI_Rewrite is an ISAPI filter written in pure C/C++ so it is extremely fast. ISAPI_Rewrite gives you the freedom to go beyond the standard URL schemes and develop your own scheme.
[Example of use] available at http://www.helicontech.com/articles/provocative_SEF_URLs.htm
Have a look at URLRewriter. Used it in production once without problems. But don't rely on that as the only quality check:
http://www.codeplex.com/urlrewriter
(It's free and has a Microsoft Public License)
Managed Fusion URL Rewriter is a powerful URL manipulation engine based on the Apache mod_rewrite extension. It is designed, from the ground up to bring all the features of Apache mod_rewrite to IIS 6.0 and IIS 7.0. Managed Fusion Url Rewriter works with ASP.NET on Microsoft's Internet Information Server (IIS) 6.0 and Mono XPS Server and is fully supported, for all languages, in IIS 7.0, including ASP.NET and PHP. Managed Fusion Url Rewriter gives you the freedom to go beyond the standard URL schemes and develop your own scheme.
IIRF
works with IIS5, 6 or 7.
Free
open source
well maintained
Free
supports regular expression pattern matching
uses .htaccess syntax
RewriteRule
RedirectRule
RewriteHeader
RewriteCond
Free
use separate config file for each IIS application or site
rule changes are loaded automatically
ProxyPass
Did I mention it is Free?
A pefect alternative to Apache mod_rewrite and other Apache modules on IIS7 is Helicon Ape. The syntax is 99% Apache compatible.
http://www.iis.net/extensions/URLRewrite was designed for IIS 7.0 and features great performance and administration UI.
IIS mod-rewrite is the best option I know, but it's not free.
ISAPI Rewrite is suitable for IIS 5 or 6. There's a Lite version available for free, or you can pay for the full version to get more features, such as proxying capabilities. It's been a while since I've used it, but it worked fine at the time.
I'm using Helicon Ape since jumped off from Apache and moved to IIS. It's syntax compatible with Apache.
You can read my article on how to use Managed Fusion URL Rewriter here:
http://carlos.mendible.com/2010/02/runnig-apache-behind-iis-server-net.html
Hope it helps.

Resources