PDA

View Full Version : always "www" at the starting of the address


Harmachis
12-20-2008, 07:21 AM
Hi,
i can visit my forum with and without adding WWW. i mean http://piratesboard.com & http://www.piratesboard.com

but i want only : http://www.piratesboard.com (with WWW, always)

i want, when someone go to address http://piratesboard.com it will autometically turn into http://www.piratesboard.com

how can i do it.

im using linux shared server with cPanel
domain registered from yahoo

Dismounted
12-20-2008, 09:16 AM
Add this to your .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

Harmachis
12-20-2008, 12:08 PM
thank you very much :)
it is working fine

popowich
12-24-2008, 02:43 AM
Hello,

If you have access to your httpd.conf you can also do this in your apache config file:

<VirtualHost x.x.x.x>
Redirect 301 / http://www.emailquestions.com/
ServerName emailquestions.com
</VirtualHost>

It's a more server friendly solution if you have that level of access to the web server.

-Raymond

Infopro
12-24-2008, 06:58 AM
Actually, http://no-www.org/index.php

Dismounted
12-24-2008, 08:25 AM
That's "no-www". The OP wants the "www". There used to be a site called "yes-www", but has since disappeared off the face of the planet.

Harmachis
12-25-2008, 08:15 AM
lol Dismounted. ya there should be a yes-www

& tnx to all

Silver Tiger
05-26-2009, 02:46 AM
Add this to your .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

I don't have the .htacess file :S

UKBusinessLive
05-26-2009, 04:55 AM
I don't have the .htacess file :S

The .htaccess file is a file which you need to make and upload to your servers root directory

Creating A .htaccess File

Creating a .htaccess file may cause you a few problems. Writing the file is easy, you just need enter the appropriate code into a text editor (like notepad). You may run into problems with saving the file. Because .htaccess is a strange file name (the file actually has no name but a 8 letter file extension) it may not be accepted on certain systems (e.g. Windows 3.1). With most operating systems, though, all you need to do is to save the file by entering the name as:

".htaccess"

(including the quotes). If this doesn't work, you will need to name it something else (e.g. htaccess.txt) and then upload it to the server. Once you have uploaded the file you can then rename it using an FTP program.