Dear all,
Hi, I would like to allow users getting redirected to www.mydomain.com if
they enter mydomain.com in the browser. I added rewrite rule in the
..htaccess that comes with symfony 1.2 but the rewrite rule does not seem to
work. When users enter mydomain.com, their browser continues to use
mydomain.com, being unaware of the rewrite rule that I added.
The .htaccess file is shown below:
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
# this is the rewrite rule that I added
# it should redirect to www.mydomain.com if http_post variable does not
start with www
# but I have no idea why it does not work
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.mydomain.com/$1 [L,R=301]
# uncomment the following line, if you are having trouble
# getting no_script_name to work
#RewriteBase /
# 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 ^(.*)$ index.php [QSA,L]
</IfModule>
I suspected that mod_rewrite is either not installed on the server (it's a
shared hosting server), or it prevents people from doing any override. After
a second thought, I changed my mind because all routing rules such as
/user/new, /product/show defined in routing.yml work perfectly. And for
these routing rules to work, the following rewrite rule defined in .htaccess
must have got executed:
RewriteRule ^(.*)$ index.php [QSA,L]
This means that this might be the problem of my rewrite rule.
Any ideas?
Many thanks to you all.
--
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en.