LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 07-21-2006, 09:36 AM   #1
ice99
Member
 
Registered: Aug 2005
Posts: 51

Rep: Reputation: 15
Need help with WWW redirection in apache


How can I redirect my domain to show 'www' in front of it. For example when someone type my domain name into a browser without the www, I want the domain to automatically default to the www, when it comes up ex. So when user enter mydomain.com I want him to be redirected directly to www.mydomain.com and automaticly to see www.mydomain.com n the addressbar insted od mydomain.com. I need this to be setup in a virtual host directive in my httpd.conf file

Thanks in advance
 
Old 08-02-2006, 01:15 AM   #2
DrAxeman
Member
 
Registered: Jun 2004
Location: State of Confusion
Distribution: My other OS is your Solaris box.
Posts: 84

Rep: Reputation: 15
You wouldn't do it entirely in apache.

Step 1. Create seperate virtual host entries for both www.website.com and website.com Have website.com use a different directory.

Step 2. Create an index.html page the does auto redirection. To do this put the following in the <HEAD> section.

<META HTTP-EQUIV="Refresh"
CONTENT="1; URL=html-redirect.html">

That should do it.
 
Old 08-02-2006, 12:02 PM   #3
benjithegreat98
Senior Member
 
Registered: Dec 2003
Location: Shelbyville, TN, USA
Distribution: Fedora Core, CentOS
Posts: 1,019

Rep: Reputation: 45
Here are 2 site from a quick google search that explain the redirect directive in virtualhosts:

http://yost.com/computers/apache-redirect/
http://www.cgi-interactive-uk.com/ap...directive.html
 
Old 08-06-2006, 01:02 AM   #4
DrAxeman
Member
 
Registered: Jun 2004
Location: State of Confusion
Distribution: My other OS is your Solaris box.
Posts: 84

Rep: Reputation: 15
That's useful info.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
redirection in apache ice99 Linux - Networking 3 07-17-2006 01:24 PM
Apache - Website Redirection Help cbarone2005 Linux - Software 2 09-29-2005 03:45 PM
Redirection in Apache gonzo22 Linux - Networking 5 02-12-2005 10:54 AM
Apache - Redirection problem... elitecodex Linux - Software 5 03-29-2004 11:12 PM
apache redirection failing acid_kewpie Linux - Networking 2 08-15-2002 05:29 PM


All times are GMT -5. The time now is 07:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration