Skip navigation
pirula08
Currently Being Moderated

ISAPI_Rewrite - Coldfusion 9.0.1 and IIS 7.5

Apr 4, 2012 2:06 PM

I need to resolve canonical URLs :

 

non-www version should be redirected (301) to www (all pages)

IP address should be redirected to www.mywebsite.com

www.mywebsite.com/index.cfm should be redirected to www.mywebsite.com

 

I would really appreciate your help on this one as the following code (.htaccess file) redirects only non-www version to www

I'm not sure what to change/add to include all of the above rules.

 

 

RewriteEngine on

 

RewriteCond %{HTTPS} (on)?

RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]

RewriteCond %{REQUEST_URI} (.+)

RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]

 
Replies
  • Currently Being Moderated
    Apr 4, 2012 2:10 PM   in reply to pirula08

    Well this has nothing to do with ColdFusion or IIS, but okay.

     

    Don't bother using ISAPI_Rewrite. IIS7 has its own built-in rewrite engine with a GUI, use that instead.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 4, 2012 2:22 PM   in reply to Owain North

    Technically its not built in but you can grab it from here: http://www.iis.net/download/URLRewrite

     

    They have a rule template for exactly what you want to do.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 4, 2012 2:25 PM   in reply to pirula08

    Well, yeah.  That will cramp your style.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2012 2:15 AM   in reply to pirula08

    Why would they recommend using isapi (an old technology) over URL Rewrite, which is a new technology? There's a GUI you can use through IIS, although I appreciate you can't use that on shared hosting. However, all the GUI does is creates an XML file (web.config) in your web root with the rules in.

     

    Use the GUI on your dev server and copy up the web.config with the rest of your files, job done.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2012 3:54 AM   in reply to pirula08

    Honestly I have no idea, as I said this is a ColdFusion forum not an IIS one so I can't help I'm afraid. Does it do what you expect it to?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points