two RewriteRules with www redirect

Posted by Eric Di Bari on Stack Overflow See other posts from Stack Overflow or by Eric Di Bari
Published on 2010-04-06T22:15:43Z Indexed on 2010/04/06 22:43 UTC
Read the original article Hit count: 613

Filed under:
|
|

I have a multiple language website, that uses subdirectories from the root ('/en' for english and '/es' for spanish) for each specific language. Each redirect appends a get variable to the URL, and hides it using a 'P' flag for proxy. My current htaccess file for the spanish subfolder is:

Options +FollowSymlinks
RewriteEngine on
RewriteOptions MaxRedirects=10
RewriteBase /
RewriteRule ^(.*)\.html$ $1.php
RewriteRule ^(.*)$ http://www.domain.com/$1?l=es [P,R=301,L]

The problem is that I also want to append the 'www' to the domain if it was left off. The proxy redirect does not show the 'www.' Is it possible to place a rewriterule before that final one that will append the www, and then still process the final one?

© Stack Overflow or respective owner

Related posts about htaccess

Related posts about www