Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Virtual Host Setup
  • From the Tutorial  I am not sure where to put the code in. 

    Is it supposed to go in fuel/.htaccess file?

    Thank you!
  • What code?
  • This code:

    <VirtualHost 127.0.0.1>
       DocumentRoot /home/phil/Sites/blog/public
       ServerName local.blog
     
       <Directory /home/phil/Sites/blog>
          Options All
          AllowOverride All
       </Directory>
    </VirtualHost>
  • HarroHarro
    Accepted Answer
    That is an apache virtual host definition, which has to go into your apache config.

    I personally use separate config files for that. In my /etc/httpd/conf/httpd.conf I have as last line:

    include /etc/httpd/vhosts/*.vhost

    Then in this directory I have a file like (using your example) local.blog.vhost, containing the above definition. This allows me to manage my configs separately.

    Don't forget to restart apache after you made changes to the config. And in this case create a hosts file entry to map local.blog to 127.0.0.1.
  • oh okay Thank you! :) 

    When uploading to production server or live site, you would use rewrite mod to remove the /public/ from the url right?
  • HarroHarro
    Accepted Answer
    That is not needed if you point your DocumentRoot to the public folder, like in your "tutorial" example. This is the standard FuelPHP design.

    This will ensure the index.php is in the document root of your website, and all your code is outside the docroot and not accessable by the browser.
  • I want to up this old question in some new aspect.

    I used my installation of fuelphp in a folder of my test server and it was configured to point http://someservername/fuelphp-folder/ as a baseurl. If I want to replace it for virtualhost and I have maked all necessary configurations with my Apache server, then what I have to do with my fuelphp installation to repoint it in the public folder?

    If I don't want to reinstall fuelphp in the virtual host, can I make some manual changes into the files or the links to do that? What exactly?
  • Sorry, I am bewildered :)
    I seemed missmatch two things... fuelphp and novius-os cms based on it.

    I see, fuelphp has no any differences with Kohana in that aspect.

    Sorry, my previous question applicable only for novius-os... but it is not place to ask it. Sorry.
  • No experience with Novius, but for all FuelPHP apps, the DocumentRoot in your virtualhost definition must point to the folder that contains the frontloader (= index.php by default).
  • This is related to the horrible frustration I just went through. 2/3rd of the day just getting mod_rewrite to allow things to work without 'index.php', E.g.:


    to 


    Obvious answer to seasoned veterans but I missed it all afternoon:

    For security reasons on Fedora (and others), the default configuration disables .htaccess
    After understanding what was needed, I looked back and have these suggestions
    to improve the documentation:

    At the bottom of Requirements it says:
    • mod_rewrite - To remove the index.php from the URL.
    It could mention there that the rewrite rules are in public/.htaccess
    and that .htaccess must be enabled or the rules moved to an
    appropriate "Directory" section.

    This note would have saved me 6 hours.
    thanks

  • Thanks for reporting. I've added a section on URL rewriting, with an explicit note about the global config.

    https://github.com/fuel/docs/commit/dc36e161ca053a0123e2cdd3b0c760b47920bc30
  • Thank you. That should help.

Howdy, Stranger!

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

In this Discussion