Question

I have this site mamgrow.lt. I want to enter mamgrow.lt in the browser and that www would appear automatically in the link after I enter it. Is it possible?

mamgrow.lt ----> ENTER ----> www.mamgrow.lt

Or should I simply redirect user to www.mamgrow.lt when he enters?

Was it helpful?

Solution

You have to create .htaccess and paste this code:

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

See How to create .htaccess file

OTHER TIPS

If you are using Apache as a webserver you can do this using a .htaccess file:

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

Here is also a generator for creating proper redirects.

Yes, it is possible using .htaccess:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top