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?

Unknown said...

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

Unknown said...

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

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

Unknown said...

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

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

Post a Comment