Quantcast
Channel: General
Viewing all articles
Browse latest Browse all 7363

Configure IIS7 subfolders to work using a web.config file

$
0
0

I am having troubles to configure IIS 7 to work as I expect. I have been looking for solutions for some months but I don't get with it... 

At my wwwroot folder i have 4 subfolders (each one for a different web app).

I am using CakePHP framework for one of those sites and the only way I found to make it work with IIS7 is pointing directly theDefault Web Site to inetpub\wwwroot\cakephp\app\webroot\ in theLocal path field of the Home Directory tab. (as is detailed on here http://bakery.cakephp.org/articles/jamesmking/2008/04/12/cakephp-on-iis6-with-fastcgi-sql-server-2005-and-isapi_rewrite)

That works perfectly, but I can not add any other website to my "Default Web Site", as to access my CakePHP app i have to use the base Url and not a subfolder: (http://myhost/)

I have tried to point only the subfolder (cakephp) Local path to that same directory but it doesn't work properly. With this, I would be able to host and access to different websites (http://myhost/cakephp/, http://myhost/app2/, http://myhost/app3/ ... )

When I try to access my site after doing so (http://myhost/cakephp/) it shows the index page, but when I try to exeute any action (http://myhost/cakephp/action/) it shows a 404 error.

Why is it if I am applying the exact same Local Path as I was applying before the the wholeDefault Web Site?
Is there any way to solve it?


Can it be because I am making use of a web.config file inside my app? 

CakePHP frameworks needs of a web.config file to work (or .htaccess in case of using Apache), which is inside inetput\wwwroot\cakephp\ :

<?xml version="1.0" encoding="UTF-8"?><configuration><system.webServer><rewrite><rules><rule name="Imported Rule 0" stopProcessing="true"><match url="^(img|css|files|js)(.*)$"></match><action type="Rewrite" url="app/webroot/{R:1}{R:2}" appendQueryString="false"></action></rule><rule name="Imported Rule 1" stopProcessing="true"><match url="^(.*)$" ignoreCase="false" /><conditions logicalGrouping="MatchAll"><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /></conditions><action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" /></rule><rule name="Imported Rule 2" stopProcessing="true"><match url="^$" ignoreCase="false" /><action type="Rewrite" url="/" /></rule><rule name="Imported Rule 3" stopProcessing="true"><match url="(.*)" ignoreCase="false" /><action type="Rewrite" url="/{R:1}" /></rule><rule name="Imported Rule 4" stopProcessing="true"><match url="^(.*)$" ignoreCase="false" /><conditions logicalGrouping="MatchAll"><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /></conditions><action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" /></rule></rules></rewrite></system.webServer></configuration>

I don't really know how it works internally but what I dont understand is why if I am pointing to the exact sameLocal Path as before, but now in a subfolder, it doesn't work. 

I hope someone can orientate with a bit more.  If you need more info about anything, just ask. 


Viewing all articles
Browse latest Browse all 7363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>