Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Problem removing index.php from url
  • I'm migrating to a production server and did a build from the ground up I've usually been able to get fuel running very quickly but can't seem to figure out why i can't remove index.php from the domain. 

    It's running on apache 2.2.6

    If I just go to the host domain the welcome controller comes through fine. If i try to go to domain.com/welcome I get an apache 404 (not fuel) 

    if I go to domain.com/index.php/welcome I can get back to the welcome controller

    Obviously I uncommented the lines 

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


    I'm thinking something isn't configured correctly in apache but not sure what that could be. Any trouble shooting tips?


  • You only need to uncomment those lines if the ajax requests to your site that are not handled by your Fuel app.

    If that is not the case, this will break all ajax requests, as they are not routed to index.php anymore, so the will not get to your REST controllers.
  • p.s. if you have control over your apache config, I would suggest moving the rewriting stuff to your virtualhost definition, remove the .htaccess, and disable htaccess support for that virtualhost.

    using htacccess can have quite a performance impact.
  • I figured it out, in the main apache config I needed to change

    AllowOverride None

    to

    AllowOverride All

    which allowed apache to pick up on the htaccess file. But yeah a better approach would be to move these rules into the virtual directory in the apache.conf file

Howdy, Stranger!

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

In this Discussion