Jump to content
spoetnik

ISAPI_REWRITE 3 on IIS

Recommended Posts

Just installed Processwire on shared hosting using IIS on windows.

Only problem I had was with the .htaccess file not doing the url rewrite. The hoster told me they use ISAPI_REWRITE 3 for IIS.

Finally got it working by commenting out line 113 "RewriteCond %{REQUEST_URI} "^/~?[-_.a-zA-Z0-9/]*$"", and now it's all working fine.

I don't understand the possible negative consequences by commenting out this line?

  • Like 2

Share this post


Link to post
Share on other sites

I'm impressed that that's all you had to do to get it to work on IIS. Perhaps our IIS support is closer than I thought. The line you commented out should be okay. It's  just there to prevent PW from dealing with bogus url requests, so more of an optimization than a requirement. Though I am surprised that all the other rewrite rules would work and that one wouldn't... while still impressed that all the others did on IIS.

Share this post


Link to post
Share on other sites

On IIS7 you don't even need ISAPI URL Rewriter from what I remember when tinkering with our server at work - if you go to Microsoft and download the IIS version of PHP from there there's a tool that actually converts the htaccess directives to something native that IIS can use. They're actually getting better at native support of PHP.

Not that that helps if you're not using IIS7 or don't have control over the server, which I imagine maybe you wouldn't on shared Windows hosting :(

Share this post


Link to post
Share on other sites

Thanks spoetnik! I removed that line it worked great! I used IIS7 rewrite module. It's very easy, just import .htaccess file and it will create rules for you. Here is the walk-through http://www.iis.net/learn/extensions/url-rewrite-module/importing-apache-modrewrite-rules

Non-profit charity wants to have their website and they already bought windows hosting package before come to me and I want to use ProcessWire because I really like the clean admin interface.

  • Like 1

Share this post


Link to post
Share on other sites

I've posted a while ago web.config file (rewritten .htaccess) for IIS:

http://processwire.c...-iis-webserver/

I think that every decent hosting provider has URL Rewrite Module installed...

I'm using IIS on my localhost due to fact that some of my clients use Window Server environments and other use Linux server environments... so it's a win-win situation.

This extension also speeds things up a bit while using PHP on IIS:

http://www.iis.net/downloads/microsoft/wincache-extension

Share this post


Link to post
Share on other sites

If you aren't using Apache, just double check that ProcessWire's files are protected. You should get a 403 "Forbidden" error if you try to access URLs like this:

  • /wire/core/ProcessWire.php
  • /site/templates/basic-page.php
  • /wire/modules/PageRender.module
  • /site/assets/sessions/

This is just a random sampling of URLs to test. But if you don't get a 403 Forbidden error for those URLs, you've got a major security problem then needs to be addressed with the server's rewrite engine. This is the main thing I worry about when people use web servers other than Apache.

  • Like 1

Share this post


Link to post
Share on other sites

Ryan, all good here, I've tried your example URL's.

Maybe I could write a small guide about installing PW on IIS...

  • Like 1

Share this post


Link to post
Share on other sites

Ryan, I have tested all your example links and no issues. I got 403 error on each of them so seems like no security holes. Thank you!

  • Like 1

Share this post


Link to post
Share on other sites

Thanks to Nikola and Spoetnik for fixing my 404 problems under IIS. I do a lot of work in ASP.NET but I'm growing weary of trying to sort out .htaccess issues in LAMP setups. And those Rewriterules are crazy!

I still have one small problem that I wonder if anyone has seen. Now that I can get into the admin pages, I find that in the footer of each page there is a lot of debug-like information, although nicely formatted - e.g. Pages Loaded, Sessions, Modules. These are in accordian views and neatly presented but I haven't seen them in the demo or on my MAMP install.

Would appreciate any ideas.

Share this post


Link to post
Share on other sites

Belay my last - I had set debug to true in my config.php. All well now. For what it's worth, I've spent a long time finding a CMS that provided just enough support but let me play with my html/css/js independently - liking what I see so far. I'm a convert from Kirby & Stacey.

  • Like 1

Share this post


Link to post
Share on other sites

Welcome to PW, John!

Glad you found the solution to your problem. Personally never heard of Kirby or Stacey (other than an area of Liverpool (spelt differently) and a mate's ex-girlfriend), but from a quick search, PW templates look somewhat similar to Kirby templates.

Anyhow, enjoy experimenting with PW and come back to the forum with any questions.

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...