Domanda

I know there are already several other posts for this topic, but I've tried everything they've said and I can't seem to get it to work.

I have the php kohana framework installed in http://localhost/kohana and it's working. The problem is that I can't get the /index.php/ removed from my URL.

I have tried importing the .htaccess file form the install into IIS URL Rewrite module, but no luck.

My bootstrap is the following

Kohana::init(array(
'base_url'   => '/kohana',
'index_file' => ''
));

My web.config that I have put in my /kohana direcotry looks like so

<configuration>
<system.webServer>
    <rewrite>
        <rules>
            <rule name="Imported Rule 1" stopProcessing="true">
                <match url="^(?:application|modules|system)\b.*" ignoreCase="false" />
                <action type="Rewrite" url="index.php/{R:0}" />
            </rule>
            <rule name="Imported Rule 2">
                <match url=".*" ignoreCase="false" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                </conditions>
                <action type="Rewrite" url="index.php/{R:0}" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

I have also tried the rewrite rules on this page

Nothing seems to work. If I go to http://localhost/kohana/index.php/welcome it works. If I go to http://localhost/kohana/welcome I get a 404 error from IIS (not a 404 in kohana).

I feel like I'm beating my head against the wall, any ideas?

È stato utile?

Soluzione 3

I just gave up and went with Apache on my Windows server. Removing the index.php worked like a charm on the first try.

Altri suggerimenti

Your web.config file is ok, I'm using the same and never had any problems. I think the problem may be in your bootstrap.php. Try this:

Kohana::init(array(
   'base_url'   => '/kohana/',
   'index_file' => FALSE
));

I was having the same problem and I downloaded this file http://www.iis.net/downloads/microsoft/url-rewrite

Then I re-openned the IIS and see that there was a new option "URL Rewrite". In the right bar of URL Rewrite have a link labeled "Import Rules...", so I imported the ".htaccess" and removed the line "RewriteBase /" because it raised an error. Then, problem solved!

 

Step-by-step:

  • Download/Install http://www.iis.net/downloads/microsoft/url-rewrite
  • Goto IIS Manager: sites/[YOUR_DOMAIN]
  • Open the new module "URL Rewrite"
  • Open the right link "Import Rules..."
  • Import your ".htaccess" file and remove the line "RewriteBase /"
  • Save!

 

Well, I hope this help somebody because I didn't find any step-by-step like this to solve my problem.

Sorry for my english.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top