Web Hosting Talk







View Full Version : cPanel Redirect from http://domain to http://www.domain


Emory
06-04-2005, 02:06 PM
I want to permanently redirect traffic from:

http://domain.com

to:

http://www.domain.com

within cPanel. I've tried adding the www within the url in the cPanel field, but the site drops. Anyone know how to do this or even if it's possible with cPanel? Thanks.

gonefishing
06-04-2005, 02:23 PM
Add the following code to your .htaccess file and clean your browser before testing it.

Options +FollowSymLinks
AllowOverride FileInfo
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]


I don't know of anyway to do what you want using cpanel though.

LadyHost
06-04-2005, 02:34 PM
In cpanel click on Redirects.
In the first box, type nothing.
In the second box type the location of the other domain.
Select Permanent in the dropdown box.
Click Add.

I hope this helps.

- LH

Emory
06-04-2005, 10:09 PM
Originally posted by gonefishing
Add the following code to your .htaccess file and clean your browser before testing it.

Options +FollowSymLinks
AllowOverride FileInfo
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]


I don't know of anyway to do what you want using cpanel though.

Is there a proper place to put these lines in the .htaccess file? If I put them under the other redirects such as

Redirect permanent /directory/file.php

I get a server error, I think it was the 500. Thanks.

gonefishing
06-05-2005, 04:25 AM
Can you post the current working .htaccess file. The code I posted should come before any other redirects.

RewriteEngine On
Options +FollowSymLinks
AllowOverride FileInfo
RewriteCond %{HTTP_HOST} ^mysite.com
RewriteRule (.*) http://www.mysite.com/$1 [R=301,L]

Emory
06-05-2005, 11:52 AM
Here's the current one. Thanks.

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
#The next line modified by DenyIP
order allow,deny
#The next line modified by DenyIP
#deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.mysite.com
AuthUserFile /home/clickfir/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/clickfir/public_html/_vti_pvt/service.grp
Redirect permanent /savior http://www.mysite.com/viewpoints/articles/christian
Redirect permanent /tools/mettyonline/ http://www.mysite.com/tools/searchengine/mettyonline_meta_tag_generator.php
Redirect permanent /writing/essays.htm http://www.mysite.com/viewpoints/articles/political/elephants.php
Redirect permanent /metty http://www.mysite.com/tools/freeware/metty
Redirect permanent /viewpoints/articles/spiritual http://www.mysite.com/viewpoints/articles/christian
Redirect permanent /freegraphics http://www.mysite.com/content/graphics
Redirect permanent /freegraphics/index.htm http://www.mysite.com/content/graphics
Redirect permanent /emory/index.htm http://www.mysite.com
Redirect permanent /emory/fccw/index.htm http://www.mysite.com
Redirect permanent /emory/centrodevictoria/index.htm http://www.mysite.com
Redirect permanent /viewpoints/articles/auctions/index.php http://www.mysite.com/viewpoints/articles/auctions/ebay.php
Redirect permanent /writers/index.php http://www.mysite.com/writers/emory%20rowland/index.php

Redirect permanent /affiliates/webmaster-talk.com/webmaster-talk-forums.php http://www.mysite.com/viewpoints/reviews/websites/

Redirect permanent /tools/webdesign http://www.mysite.com/tools/web_design

Redirect permanent /tools/web_design/menumaker http://www.mysite.com/tools/web_design/menu_maker

Redirect permanent /tools/christian/biblestudy http://www.mysite.com/tools/christian/bible_study

Redirect permanent /freeware/metty http://www.mysite.com/tools/freeware/metty

Redirect permanent /download/rdsetup.exe http://www.mysite.com/download/rd10.exe


<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from 24.167.242.185
deny from 67.163.64.212
deny from 62.65.252.68
deny from 66.7.164.225
deny from 216.169.118.12
deny from 209.10.169.53
deny from 209.8.166.192
deny from 207.44.130.115
deny from 66.174.3.30

BenEDH
06-05-2005, 06:05 PM
If you don't mind me asking, what purpose does this redirect serve, other than adding the www? Is it just asthetic?

Emory
06-05-2005, 07:25 PM
It's partly aesthetic, yeah, but also for uniformity.