Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URL Rewrite with Joomla on IIS7

I have Joomla 1.5.9 running on IIS7. I'm now experimenting with the SEO Settings from the Joomla global configuration page.

First I toyed with Search Engine Friendly URLs (that gets rid of the queries part of URLs); that works fine.

I also tried to enable the "Use Apache mod_rewrite". I installed "Microsoft URL Rewrite Module for IIS 7.0" and added the web.config as per http://learn.iis.net/page.aspx/527/joomla-on-iis . When clicking on menu links, this seems to work in that I no longer see index.php in the URL. The address bar updates to what appears like the right URL, but the content shown is always that of the home page. I tried both in IE and Google Chrome with the same result. Refreshing the page after loaded made no difference.

I tried re-starting IIS7, it didn't make a difference.

Edit: After I followed the suggestion below (followed instructions at http://www.mydotnetworld.com/post/2008/10/24/URL-Rewriting-In-Joomla-15-on-IIS-7.aspx :turned on fast cgi, modified php.ini, and imported rewrite rules instead of putting them in a web.config myself), I now get 404's instead of just showing the home page's content. The URL still appears to be correctly rewritten. So, different behavior but still doesn't work. I'm not sure this is useful information, but these two fields are shown in the 404 page: Requested URL http://localhost:80/joomla_course/seasonal-specialties Physical Path C:\inetpub\wwwroot\joomla_course\seasonal-specialties Should the physical path be the 'non-rewritten' URL? Or is it expected that that it be like this?

Edit 2: Oho! I found someone with the same issue posted on Joomla forums: http://forum.joomla.org/viewtopic.php?f=543&t=364706&p=1598137#p1598137 . No answer there either, though.

Any idea on how to diagnose (or even better, fix :) ) this?

Thanks!

like image 678
Jimmy Avatar asked Nov 14 '22 16:11

Jimmy


1 Answers

I got this to work now. The key was to make sure FastCGI is used to run php (as per http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70 ), and making sure that the "Use Apache mod_rewrite" is enabled. If "Use Apache mod_rewrite" is turned off but the rewrite rules are present in IIS7, then the HTML shows up but none of the styling or images.

The requirement for using FastCGI is weird (and contradicts what is suggested in http://maximumpcguides.com/windows-vista/how-to-create-a-windows-vista-iis7-mysql-php-web-server , which is what I used to setup php in the first place). Everything seems to work when not using FastCGI, except for the URL rewriting.

It seems that either importing the rules (as suggested in http://www.mydotnetworld.com/post/2008/10/24/URL-Rewriting-In-Joomla-15-on-IIS-7.aspx) or manually adding them to a web.config file (as suggested in http://learn.iis.net/page.aspx/527/joomla-on-iis ) will work.

like image 128
Jimmy Avatar answered Dec 04 '22 03:12

Jimmy