Lighttpd redirect all requests to new domain/host

To redirect all requests to new domain add following condition in your lighttpd.conf and restart lighttpd.

Here in the example I am trying to redirect all requests coming to http://www.dummy.com to http://www.example.com

$HTTP["host"] =~ "www\.dummy\.com$" {

url.redirect = ( "^/(.*)" => "http://www.example.com/" )

}

After adding above rule restart lighttpd.

$ service lighttpd restart

Now open the browser and type http://www.dummy.com and it should automatically redirected to http://www.example.com.

In above example according to your requirement change the domain/host names and test.

-Sany

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s