Forum Moderators: phranque

Message Too Old, No Replies

RewriteRule Opinions

RewriteRule help requested

         

nickCR

11:21 pm on Jun 2, 2007 (gmt 0)

10+ Year Member



Forum,

I just have two quick questions.

First between these which is better while working with sub-domains:

RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

or

RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

or

RewriteCond %{HTTP_HOST}!^(www\.¦$) [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

or maybe another one that is better that you guys will suggest?

Second question is which is the correct to write this:

[R=301,L]

or

[L,R=301]

Regards,

Nick

[edited by: encyclo at 12:32 am (utc) on June 3, 2007]
[edit reason] switched to example.com and delinked [/edit]