Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Running fuel on localhost
  • Newbie to fuelphp and trying to work on an inherited project from client.

    Requirement:
    • Need to create a login page for admin
    • The page needs to show quarterly snapshots of the client's database
    I am trying to run the site on my local IIS. However, the issue is that index.php is the only page working since obviously it is the default root. I would like to be able to  browse the rest of the pages and create a new login page. When browsing to other pages I get error 404 unfortunately. 

    The .htaccess file is as follows (I am trying to uncomment lines as suggested to avoid 404 but to no avail) :

    # Multiple Environment config, set this to development, staging or production
    # SetEnv FUEL_ENV production

    RewriteBase /btw/

    <IfModule mod_rewrite.c>

        # Make sure directory listing is disabled
    Options +FollowSymLinks -Indexes
    RewriteEngine on

    # NOTICE: If you get a 404 play with combinations of the following commented out lines
    #AllowOverride All
    #RewriteBase /wherever/fuel/is

    # Restrict your site to only one domain
    # !important USE ONLY ONE OPTION

    # Option 1: To rewrite "www.domain.com -> domain.com" uncomment the following lines.
    #RewriteCond %{HTTPS} !=on
    #RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    #RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

    # Option 2: To rewrite "domain.com -> www.domain.com" uncomment the following lines.
    #RewriteCond %{HTTPS} !=on
    #RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
    #RewriteCond %{HTTP_HOST} (.+)$ [NC]
    #RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]

    # Remove index.php from URL
    #RewriteCond %{HTTP:X-Requested-With} !^XMLHttpRequest$
    #RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]
    #RewriteRule ^index\.php(.*)$ $1 [R=301,NS,L]

    # Send request via index.php (again, not if its a real file or folder)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    # deal with php5-cgi first
    <IfModule mod_fcgid.c>
    RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
    </IfModule>

    <IfModule !mod_fcgid.c>

    # for normal Apache installations
    <IfModule mod_php5.c>
    RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>

    # for Apache FGCI installations
    # note '?' removed to prevent url appearing in Input::get()
    <IfModule !mod_php5.c>
    RewriteRule ^(.*)$ index.php/$1 [QSA,L]
    </IfModule>

    </IfModule>

    </IfModule>

    Thanks in advance
    l;
  • HarroHarro
    Accepted Answer
    IIS doesn't use .htaccess, that is a file for Apache. IIS uses the web.config file, a default one is included but you'll have to modify it for your specific setup to make the rewrites work.

  • At the moment my web.config only has php handler and default index.php

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
    <defaultDocument>
    <files>
    <add value="index.php" />
    </files>
    </defaultDocument>
    <handlers>
    <remove name="PHP_via_fastCGI" />
    <add name="PHP-FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP\php-cgi.exe" resourceType="Either" />
    </handlers>
    </system.webServer>
    </configuration>


    I tried importing .htaccss in my IIS mod-rewrite. While 5/8 rules were converted, the following 3 rules failed to convert:

    <!--This directive was not converted because it is not supported by IIS: RewriteBase /btw/.-->
        
    RewriteBase /btw/

    <!--This directive was not converted because it is not supported by IIS: RewriteBase /wherever/fuel/is.-->

    RewriteBase /wherever/fuel/is

    <!--The rule cannot be converted into an equivalent IIS format because of unsupported flags: NS-->

    RewriteRule ^index\.php(.*)$            $1 [R=301,NS,L]


    Again, thank you
  • HarroHarro
    Accepted Answer
    Yes, the web.config file in the document root (which normally is your public folder) contains the IIS rewrite instructions.

    config in general doesn't need any changes unless you're doing very weird stuff...;)

    If you have a setup where public is not your document root (not advised), you need to tweak things as the file should be in the document root of your website. Some guidelines can be found in the docs.
  • Thank you for the guidance. I have successfully configured the site after much reading around importing rewrites and can finally complete the task at hand :)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion