This is what I use for symfony2:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteRule ^index.php/(.*)?$ /$1 [L,R=301]

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)/$ $1 [L,R=301]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

On Dec 21, 3:56 pm, gordonslondon <jules.boussek...@gmail.com> wrote:
> hi,
> the default symfony2 .htaccess is:
>
> <IfModule mod_rewrite.c>
>   RewriteEngine On
>
>   RewriteCond %{REQUEST_FILENAME} !-f
>   RewriteRule ^(.*)$ index.php [QSA,L]
> </IfModule>
>
> know i want two things:
>
>    1. redirect *www.example.com*to *example.com* (force non-www or
>    vice-versa)
>    2. redirect *example.com/index.php/mypage.html *to *
>    example.com/mypage.html* (no duplicate content)
>
> For the first one i have (it's work great but when i go to 
> *www.example.com/mypage*it redirects to* example.com/)*:
>
>   RewriteCond %{HTTP_HOST} ^www\.[a-z-]+\.[a-z]{2,6} [NC]
>   RewriteCond %{HTTP_HOST} ([a-z-]+\.[a-z]{2,6})$ [NC]
>   RewriteRule ^(.*)$ http://%1/$1 [R=301]
>
> For the second one i have (it work only with *example.com/index.php *not *
> example.com/index.php/mypage*) :
>
>  RewriteCond %{THE_REQUEST} index.php
>  RewriteRule ^(.*)index.php$ http://%{HTTP_HOST}/ [R=301,NS,L]
>
> Is anybody has any tips ? Something i might have forgotten ?
> thanks in advance

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@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

Reply via email to