Development

HowToRedirectPublicHtmlToWebFolder

You must first sign up to be able to contribute.

Version 1 (modified by smeves, 11 years ago)
--

How To Install Your Symfony App On A Shared Host To Your Root Domain With No vhost.conf Access

If you upload your new symfony site to a shared host, and put all of symfony's files into your ~/public_html/ directory, the symfony application is served up with a "/web" at the end. There are a few ways to serve your site up at the root of the domain without having all of your symfony files stored in public_html. Here is one way you can to get around this issue without reinstalling symfony and without access to your vhost.conf or httpd.conf file.

1. Copy all the symfony files from ~/public_html over to a new ~/symfony directory:

cp ~/public_html/* ~/symfony

2. Move the ~/public_html directory to a backup:

cp ~/public_html ~/public_html.bkp

3. Create a new symlink that points ~/public_html to symfony's web directory

ln -s ~/symfony/web/ ~/public_html

4. Now, for some reason the .htaccess file from the old public_html folder didn't get copied. So, make sure copied it over to ~/symfony/web/:

cp ~/public_html.bkp/.htaccess ~/public_html
# note the new public_html folder actually points to ~/symfony/web

5. Finally edit the .htaccess file in the ~/symfony/web folder so that all requests are directed to just "index.php" file rather than "web/index.php" like it used to be:

RewriteRule ^(.*)$ /index.php [QSA,L]
#RewriteRule ^(.*)$ /web/index.php [QSA,L]

6. One last thing... Make sure to change permissions on the cache and log folders:

chmod 777 -R ~/symfony/log ~/symfony/cache

DRAFT