symfony Uncategorized

In continue to htaccess trick


we’ve already published bunch of information about tricks with .htaccess in symfony projects (see e.g. Tricks with symfony .htaccess and How to hide symfony project in subfolder). Here is another one helpfull tip which you may use in your project. It works a bit differently from what we’ve already wrote about “How to use Symfony along with the other software in the same directory”. So this is the case when you want to use index.php root folder as symfony controller but you want also to handle requests to “myapp” (which is something different from symfony) and located in myapp folder. It means your .htaccess has to catch all requests to myapp and processes them separately from symfony, so here are the rules you’d need to add:

RewriteRule ^(myapp/([^.]+))$ /myapp/index.php/$1 [QSA,L]
RewriteRule ^(myapp/*)$ /myapp/index.php [QSA,L]

This way you can use CMS like WordPress / Joomla / Drupal along with your symfony app. You can be interested in this information How To Integrate WordPress And BbPress With Symfony if you decided to integrate your symfony project with some existing software. Lets say, would be ultimately interesting to see if there is any integration of WordPress MU or even BuddyPress or with symfony?

2 replies on “In continue to htaccess trick”

Another way to “disable” given directory is to put new .htaccess file in /myapp directory, with below content:

RewriteEngine Off

Leave a Reply

Your email address will not be published. Required fields are marked *