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... :)

6 comments:

deva said...

what is .htaccess in symfony?

girish said...

Hi Kannan, good blog. Please keep adding more Symfony Tips and help the Open Source Community.

kayal said...

hai.. How to save the date input as a null value while without giving date input

Kannapiran said...

When forming the table you should give param default as NULL. So date field will be save as NULL when u not choosing the date. :)

kayal said...

how to get date format as dd-mm-yy in object_input_date_tag

kayal said...
This comment has been removed by a blog administrator.

Post a Comment