Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How do I set up multiple fuel installs under the same server with different subdomains?
  • So I'm trying to run a few different fuel applications under one domain with different subdomains ie app1.domain.com
    app2.domain.com I've installed fuel in two directories under the path's
    /var/www/app1/
    /var/www/app2/ I have apache virtual servers directing traffic accordingly
    NameVirtualHost *:80 <VirtualHost *:80>
    ServerName app1.domain.com
    ServerAlias app1.domain.com
    DocumentRoot /var/www/app1
    </VirtualHost> <VirtualHost *:80>
    ServerName app2.domain.com
    ServerAlias app2.domain.com
    DocumentRoot /var/www/app2
    </VirtualHost> The subdomains point to their respective fuel splash pages without any problem, but outside of that I can't get any uri's to route correctly I just get a 404. If I go to app1.domain.com/welcome I'll get a generic apache 404 page, (not fuel). And in the apache error log I see File does not exist: /var/www/app1/public/welcome So I get this isn't entirely a fuel php question but could use some help. I'm not sure if I need to do some sort of other apache mod rewrite, or try to redefine the fuel constants like app path or what. I'm hoping someone else out there has figured out how to run multiple applications under a single domain.
  • Set your documentroot to /var/www/app1/public, otherwise the default rewriting rules won't work, as they expect 'public' to be your docroot.
  • Harro Verton wrote on Wednesday 11th of July 2012:
    If you're not getting a fuel 404 error, then your rewriting doesn't work and index.php isn't called. You could test that using http://app1.domain.com/index.php/test which should work if everything is installed correctly.

    Using the full URL with index DOES indeed work, so I guess its an apache rewrite issue with the .htaccess file
    <IfModule mod_rewrite.c>
        RewriteEngine on
    
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
    
        RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>
    

    and my virtual hosts setup in httpd.conf
  • Yeah even when I do that I still run into the same problem. The welcome controllers work for each app but beyond that nothing is understood. For example I have a controller "test" for app1. The URL should be app1.domain.com/test/ I get a 404 error (again not a fuel 404 error) in apache. "File does not exist: /var/www/app1/public/test" Is that the way the router is supposed to be interpreting the controller?
  • If you're not getting a fuel 404 error, then your rewriting doesn't work and index.php isn't called. You could test that using http://app1.domain.com/index.php/test which should work if everything is installed correctly.
  • Try setting a rewrite base in your mod_rewrite block
    RewriteBase /
    

Howdy, Stranger!

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

In this Discussion