0

I have a website named redpeppermedia.in and I wish to see it's url as www.redpeppermedia.in instead of redpeppermedia.in

Do you have any idea how to do it? It's a simple website, I'm not using wordpress or drupal or any sort of website creation tool.

Thank You..

Awesomestvi
  • 783
  • 1
  • 5
  • 14

2 Answers2

1

add file .htaccess to your website's root, then add the the following lines

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.redpeppermedia.in$ [NC]
RewriteRule ^(.*)$ http://www.redpeppermedia.in/$1 [L,R=301]
anthumchris
  • 8,245
  • 2
  • 28
  • 53
0

You need to write in your .htaccess file the mod rewrite to automatically setup the 'www' if the subdomain not exists. Just can see other examples

.htaccess redirect - automatically add www. if no subdomain exists

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

You can check the 'mod rewrite' extension in the Apache foundation oficial website.

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

Community
  • 1
  • 1
Boky
  • 71
  • 4