Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
hide public in url
  • I don't want to display /public/ in my url
    I have [url=http://localhost/fuelphp/intranet/public/fr/]http://localhost/fuelphp/intranet/public/fr/[/url]
    and i want [url=http://localhost/fuelphp/intranet/fr/]http://localhost/fuelphp/intranet/fr/[/url]
    I don't know how to do it can someone help me? do I have to change the config.php file? do I have to rite a rule in routes.php?
    thanks for your help
  • The FuelPHP file structure is designed so that public is your docroot, and everything else is outside the docroot. In this case everything is inside the docroot, so having a separate public folder is useless. Copy the contents of the public folder one level up (to intranet), remove the public folder, and make sure your rewrites now use the index.php in the intranet folder. Also, update the paths in index.php, as they are relative by default. Moving the file means the core can no longer be found. p.s.: don't use "localhost" as hostname. It is an invalid hostname as per RFC, you are going to have problems if you want to use cookies (or session) in your application.
  • thanks for your help
  • You could set up a virtual host in your apache config so that your url would be: http://mybox.dev/fr/ Something like this would work... <VirtualHost *:80>
    DocumentRoot "/path/to/fuelphp/public/"
    ServerName mybox.dev
    <Directory "/path/to/fuelphp/public/">
    AllowOverride all
    </Directory>
    </VirtualHost>
  • I found other solution via .htaccess. Just put the file in the webroot folder.

    RewriteEngine On

    RewriteRule ^\.htaccess$ - [F]
    RewriteCond %{REQUEST_URI} =""
    RewriteRule ^.*$ /public/index.php [NC,L]

    RewriteCond %{REQUEST_URI} !^/public/.*$
    RewriteRule ^(.*)$ /public/$1

    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^.*$ - [NC,L]

    RewriteRule ^public/.*$ /public/index.php [NC,L]

Howdy, Stranger!

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

In this Discussion