views:

25

answers:

1

Hello,

Let's say I have the domain "example.com" I would like to add a route such as when the URL is "example.com/whatever/follows" it redirects to "http://www.example.com/whatever/follows" (forwarding the query strings too).

Basically I would like to translate into Zend the following Apache Rewrite rule:

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

How can we do that if possible at all?

Cheers,

+2  A: 

I would recommend to keep it as a apache rule, as it is faster and is the correct way to do. WWW is actually a subdomain value not an optional feature and it should not be present, unless you want the subdomain.

Also check the no-www site.

Elzo Valugi