Disable default Symfony Modules and Errors

on Saturday, March 21, 2009

To disable the default symfony pages like "Symfony Project Created", "Symfony 404 Page Not Found" errors to customized error message, follow the steps

1. In your project root select your application, then open the settings.yml file from config folder.

2. After that enable the selected modules which you want to work, after that edit your settings.yml below .actions as follows.,

default_module: your_module_name

default_action: your_action_name
.
.
.
.etc...

3. After that edit your routing.yml file as just change the default module to your_module_name which is mentioned in settings.yml

4. Now Clear the Cache and run your project. You Won't get any symfony pages and error messages.


Hope you will Enjoy.....! :)



Symfony Tips and Tricks

on Wednesday, March 11, 2009

How to get visitors redirected to www.yourdomain.com

Sometimes you dont have domain name but you would like to get your symfony project working. For that just place the .htaccess file from web folder to outside of the project root folder. After that edit the .htaccess file as follows.


RewriteEngine On

# uncomment the following line, if you are having trouble
# getting no_script_name to work
#RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

# we skip all files with .something
RewriteCond %{REQUEST_URI} \..+$
RewriteCond %{REQUEST_URI} !\.html$
RewriteRule .* - [L]

# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f

# no, so we redirect to our front web controller
RewriteRule ^(.*)$ web/index.php [QSA,L]



So, after entering the domain name it will automatically take to the production environment of your project..

Enjoy It...! Have a fun... :)