This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Installing Symfony to subdirectory

Discuss installing Symfony 2 here

Installing Symfony to subdirectory

by sebestenyb » Tue Mar 19, 2013 10:07 pm


I'm struggling with a thought to be simple issue, aka installing Symfony in a subfolder.
I've downloaded and put the whole Symfony into a subfolder called 'symfony' in my local environment.
I also edited the .htaccess:
Code: Select all
php_value    date.timezone       "Pacific/Auckland"
php_value    detect_unicode       "0"

RewriteEngine       on
RewriteCond       %{REQUEST_FILENAME} !-f
RewriteRule       ^(.*)$ /symfony/web/app_dev.php [QSA,L]

Everything works if I visit the url http://localhost/symfony/web/app_dev.php/, but as soon as I try to use nice urls like http://localhost/symfony/, a 'No route found for "GET /symfony/"' exception is raised.
If I check the source, I can see that it attempts to load the assets from the webroot (href="/bundles/framework/css/structure.css"), while visiting the ugly url gives the correct path.

I have not modified any routing or so, it's a vanilla install.

Is there an easy way - without modifying each and every route - to use symfony from a subdirectory?

Any help would be appreciated :)

Cheers, S

PS: More technically I'm looking for a solution similar to the Zend Framework's resources.frontController.baseUrl config setting, where you can modify the whole application's base url with a single line in your config file, giving an easy way to support different setups for different environments.
Junior Member
Posts: 1
Joined: Tue Mar 19, 2013 9:41 pm

Re: Installing Symfony to subdirectory

by lucian303 » Fri Jun 14, 2013 1:54 am

Previously, I believe it worked with a

Code: Select all
RewriteBase /symfonytest

directive. The new .htaccess file is quite cryptic and for all it tries to be, it fails completely at picking up sy2 in a subdirectory. I have tried everything I can think of so far including apache rewrites, aliases, etc., and I have yet to find a way to run sy2 out of a subdirectory.

I don't think it's possible. If it is, it's definitely _not_ documented. And RewriteBase doesn't work anymore either. :(
Junior Member
Posts: 2
Joined: Fri Jun 14, 2013 1:50 am