Go Back   DN Lodge Webmaster Forums > Web Design and Development > Web Development Discussion


Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 08-03-06, 03:31 AM
Soul's Avatar
Soul Master
 
Join Date: Aug 2006
Location: Filipinas
Posts: 8
DNL Trust: (0)
Send a message via MSN to Soul Send a message via Yahoo to Soul
Soul is a pretty decent person
Default Redirecting Domain.com to www.Domain.com

This simple trick allows you to redirect your site without the www (domain.com) to the www version (www.domain.com). All you need to do is make a simple .htaccess edit.

Here's what you have to do:

1. Download your .htaccess file from your site's folder. If you have another site that is a subdomain or an add-on, go inside the folder. If it's in the root folder, edit the .htaccess in your root foder (public_html)

2. Open the file with your favourite text editor, i.e. Notepad.

3. Add this code at the top most area of the codes inside your .htaccess.

Quote:
RewriteEngine on

RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule (.*) http://www.domain.com/$1 [R=Permanent]
Be sure to edit the "domain.com" to your site's domain name.

So it would look something like this:

Quote:
RewriteEngine on

RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule (.*) http://www.domain.com/$1 [R=Permanent]

# -FrontPage-

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

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.domain.com
AuthUserFile /home/accountname/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/accountname/public_html/_vti_pvt/service.grp
4. Upload your file and replace your old .htaccess and that's it.

5. Try surfing for your site domain.com without www and if the www shows up, it worked.

Enjoy! :sad:

BTW, if you think like this guy does,

Quote:
I understand what you are doing, but why would you want to?
The shorter the name the better. Less the www the better too.
What is the benefit of doing this?
Here's the answer.

Quote:
The Search Engine Crawlers interprete URLs like

http://domain.com/ ( Non-www version)
http://www.domain.com/ ( www version)

as different urls containing the same content. With recent Google drive to track pages containing duplicate content, there is always a possibility that your website may be penalised. So if you have the same problem ( just make a site: query in Google to see whether both www version as well as non-www version of your webpage is indexed therein), you need to resolve it at once.

-astahost.com
__________________
WWW.SOULSTALK.COM - WHERE SOULS WORLDWIDE GATHER!
"It is better to have only two ideas and one of them is wrong, than to have loads of right ideas but NONE OF THEM ARE YOURS!"
- Soul
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Want to remove these ads? Register for your free account here.

  #2  
Old 08-03-06, 11:13 AM
Brandon's Avatar
DNL Founder/Moderator
DNLodge Staff
 
Join Date: Aug 2005
Location: USA
Posts: 5,131
DNL Trust: (0)
Send a message via AIM to Brandon Send a message via MSN to Brandon Send a message via Skype™ to Brandon
Brandon is making his way to the top
Default Re: Redirecting Domain.com to www.Domain.com

Also post here...
http://www.dnlodge.com/search-engine...n-www-www.html
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 08-09-06, 08:15 AM
DNL Member
 
Join Date: Aug 2006
Posts: 70
DNL Trust: (0)
farooqaaa is a pretty decent person
Default Re: Redirecting Domain.com to www.Domain.com

Thanks alot Soul for the help Soul! i really appreciate your help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 08-09-06, 09:31 AM
Gareth_Boyd's Avatar
Neanix Web Hosting
 
Join Date: Jan 2006
Posts: 1,138
DNL Trust: (0)
Send a message via AIM to Gareth_Boyd Send a message via MSN to Gareth_Boyd Send a message via Skype™ to Gareth_Boyd
Gareth_Boyd is a pretty decent person
Default Re: Redirecting Domain.com to www.Domain.com

Good for seo as well! So search engines dont think there is more than one site on your domain
__________________
Finance Blog - Gareth Boyd - Techniques, Tips and Guides.
Neanix Cheap Web Hosting - Shared and Reseller.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 08-09-06, 10:02 AM
DNL Member
 
Join Date: Aug 2006
Posts: 70
DNL Trust: (0)
farooqaaa is a pretty decent person
Default Re: Redirecting Domain.com to www.Domain.com

Lolz @ Gareth :D
Quote:
offtopic:
Lol Gareth, you always cares of SEO! don't know why you love the seo that much!

Last edited by farooqaaa; 08-09-06 at 10:05 AM..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 08-09-06, 04:51 PM
Gareth_Boyd's Avatar
Neanix Web Hosting
 
Join Date: Jan 2006
Posts: 1,138
DNL Trust: (0)
Send a message via AIM to Gareth_Boyd Send a message via MSN to Gareth_Boyd Send a message via Skype™ to Gareth_Boyd
Gareth_Boyd is a pretty decent person
Default Re: Redirecting Domain.com to www.Domain.com

It means you rank on Google! Duh
__________________
Finance Blog - Gareth Boyd - Techniques, Tips and Guides.
Neanix Cheap Web Hosting - Shared and Reseller.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
domaincom, redirecting, wwwdomaincom


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Redirecting non-www to www Brandon Search Engine Optimization 2 05-12-06 12:35 PM


All times are GMT -5. The time now is 03:51 PM.



Copyright © 2005-2009 DNLodge.com.
vBulletin, © 2000-2009, Jelsoft Enterprises Limited.
SEO by vBSEO.
Advertising |  About Us |  Contact Us |  RSS |  Privacy Policy |  Back to Top