Month: April 2009

How to add or condition in mysql query in symfony

$c1 = $c->getNewCriterion(TblUsersPeer::USR_PARENTID,$this->getUser()->getAttribute(‘userid’),Criteria::EQUAL);
$c2 = $c->getNewCriterion(TblUsersPeer::USR_PARENTID,null, Criteria::ISNULL);

How to configure the symfony project directory

Your symfony project derectory is “/var/www/html/sf_sandbox” so in the browser you can acess this by this URL : “http://localhost/sf_sandbox/web/frontend.php/”

So if you want to map the symfony project directoy to your web root directory ie i mean to say you just want to acess it my using the URL :”http://localhost/” then you have to add the below line in the httpd.conf file and then restart your apache server.After that you can directly acess the symfony project from localhost url.

<VirtualHost *:80>
ServerName http://localhost/
DocumentRoot “/var/www/html/sf_sandbox/web”
DirectoryIndex index.php
<Directory “/var/www/html/sf_sandbox/web”>
AllowOverride All
Allow from All

Rest of the things will be handled by symfony itself.

How to redirect domain to other directory on the same domain

Open the .htaccess file of your root directory
of your project and add the following line.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^ [NC]
RewriteCond %{HTTP_HOST} !^ [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteCond %{REQUEST_URI} !^/someOtherDirectory/
RewriteRule ^(.*)$ /someOtherDirectory/$1

Then restart your apache

Usage :
Suppose your project is placed in some other directory
other than the default web directory then you can redirect
your request to that directory for example

Your actual project URL is
and you want that your URL should resemble like
then the above .htaccess rule will do the same.