Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 17th February 2010, 20:09
smartin smartin is offline
Member
 
Join Date: Dec 2007
Posts: 82
Thanks: 3
Thanked 0 Times in 0 Posts
Default Newb: How to redirect from domain.com to www.domain.com

Hi,

I have ISPc3 running on Ubuntu 8.04 LTS.

On one of my sites I have Drupal installed. I noticed that when I go to http://domain.com I just get the default apache 'It works!' page.

How do I redirect this page to my site on http://www.domain.com?

in the .htaccess file at the root of the /web directory I have:
Code:
# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # adapt and uncomment the following:
  RewriteCond %{HTTP_HOST} ^mydomain\.co.uk$ [NC]
  RewriteRule ^(.*)$ http://www.mydomain.co.uk/$1 [L,R=301]
This isn't doing the job. What else do I need to do? (www.mydomain.co.uk is the domain I'm using...)

The apache mod_rewrite module is enabled.

Thanks :-)

S

Last edited by smartin; 17th February 2010 at 20:12.
Reply With Quote
Sponsored Links
  #2  
Old 17th February 2010, 20:20
frument frument is offline
Junior Member
 
Join Date: Feb 2010
Location: Philly
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to frument Send a message via MSN to frument Send a message via Yahoo to frument Send a message via Skype™ to frument
Default

You can add it from the ISPC3 admin panel.

Sites > yourdomain.com > Auto Subdomain: Drop down to www.
Reply With Quote
The Following User Says Thank You to frument For This Useful Post:
TheBirdMan (5th August 2010)
  #3  
Old 17th February 2010, 20:26
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
Default

The Drupal rewrites work, I have them in several sites. It looks more like your DNS isn't set up correctly. If you are going to the /var/www. instead of the /var/www/somedomain.com/web/.

In your DNS make sure you have A records for mydomain.co.uk. (dot at end) and www (no dot at end) both pointing to your IP address.
__________________
System6Hosting.com, ISPConfig 3, Debian.
Reply With Quote
  #4  
Old 17th February 2010, 20:42
smartin smartin is offline
Member
 
Join Date: Dec 2007
Posts: 82
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by frument View Post
You can add it from the ISPC3 admin panel.

Sites > yourdomain.com > Auto Subdomain: Drop down to www.
frument,

That didn't do it... Probably a DNS thing as BorderAmigos is saying.

Thanks though!

S
Reply With Quote
  #5  
Old 17th February 2010, 20:50
smartin smartin is offline
Member
 
Join Date: Dec 2007
Posts: 82
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by BorderAmigos View Post
The Drupal rewrites work, I have them in several sites. It looks more like your DNS isn't set up correctly. If you are going to the /var/www. instead of the /var/www/somedomain.com/web/.

In your DNS make sure you have A records for mydomain.co.uk. (dot at end) and www (no dot at end) both pointing to your IP address.
BorderAmigos,

I should have though of the DNS...

My provider allows me to control things in this way:
entry box | .domain (fixed) | Dropdown menu for Type | entry box for ip address

I did have set:
blank box | .domain | A record | my Ip address
* |.domain | A record | my IP address

Now I have:
* | .domain | A record | my IP address
www | .domain | A record | my IP address.

Is that going to do the job?

I thought <blank>.domain would already have sent everything to my IP...?

Have to wait 24h to see... :-)

S
Reply With Quote
  #6  
Old 17th February 2010, 21:05
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
Default

Are you using ISPConfig 3? You should just be able to add an A record in DNS under the Records tab. Here is an example of the DNS records I have set in ISPConfig3 DNS for each domain name...

Type Name Data Priority...

A host 123.123.123.123 0
A mail 123.123.123.123 0
A ns1 123.123.123.123 0
A ns2 123.123.123.123 0
A example.com. 123.123.123.123 0
A www 123.123.123.123 0
CNAME css example.com. 0
CNAME img example.com. 0
CNAME js example.com. 0
CNAME tryout example.com. 0
MX example.com. host.example.com. 10
NS example.com. ns1.example.com. 0
NS example.com. ns2.example.com. 0
TXT example.com. v=spf1 mx -all 0 0

(The CNAMES are for specific Drupal modules I use and not required for everything).
__________________
System6Hosting.com, ISPConfig 3, Debian.

Last edited by BorderAmigos; 17th February 2010 at 21:12.
Reply With Quote
  #7  
Old 17th February 2010, 23:36
smartin smartin is offline
Member
 
Join Date: Dec 2007
Posts: 82
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by BorderAmigos View Post
Are you using ISPConfig 3? You should just be able to add an A record in DNS under the Records tab. Here is an example of the DNS records I have set in ISPConfig3 DNS for each domain name...

Type Name Data Priority...

A host 123.123.123.123 0
A mail 123.123.123.123 0
A ns1 123.123.123.123 0
A ns2 123.123.123.123 0
A example.com. 123.123.123.123 0
A www 123.123.123.123 0
CNAME css example.com. 0
CNAME img example.com. 0
CNAME js example.com. 0
CNAME tryout example.com. 0
MX example.com. host.example.com. 10
NS example.com. ns1.example.com. 0
NS example.com. ns2.example.com. 0
TXT example.com. v=spf1 mx -all 0 0

(The CNAMES are for specific Drupal modules I use and not required for everything).
BorderAmigos,

I'm really sorry. I wasn't clear... I'm not using ISPc3 for DNS. My registrar is handling it.

I'll see in another 18h or so if things are working.

Really appreciate you putting me on the right track.

S
Reply With Quote
  #8  
Old 18th February 2010, 18:52
smartin smartin is offline
Member
 
Join Date: Dec 2007
Posts: 82
Thanks: 3
Thanked 0 Times in 0 Posts
Default Still not working...

Hi,

Hmmm, just been on the phone to the people handling the DNS and they say the DNS is set up correctly but things are still not working properly.

Can anyone think what I'm doing wrong still? The issue seems to be with my setup.

S
Reply With Quote
  #9  
Old 22nd February 2010, 10:23
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 34,561
Thanks: 791
Thanked 4,978 Times in 3,899 Posts
Default

Does:

ping www.yourdomain.com

when you execute it on your workstation return the corect IP address of your server? the same IP that you get when you run:

ping yourdomain.com
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #10  
Old 22nd February 2010, 10:33
smartin smartin is offline
Member
 
Join Date: Dec 2007
Posts: 82
Thanks: 3
Thanked 0 Times in 0 Posts
 
Default

Quote:
Originally Posted by till View Post
Does:

ping www.yourdomain.com

when you execute it on your workstation return the corect IP address of your server? the same IP that you get when you run:

ping yourdomain.com
Hi Till,

Yes, both www.mydomain.co.uk and mydomain.co.uk pings the correct IP address.

Any thoughts on where my problem lies?

S
Reply With Quote
Reply

Bookmarks

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
(Solution!) Redirect domain.com and co-domains to www.domain.com lubos Tips/Tricks/Mods 0 8th June 2009 02:28
Codomains - have domain.com redirect to www.domain.com? mxc General 4 2nd May 2009 11:17
bind problem. domain.com doesn't resolve to domain.net bob808 Server Operation 4 29th April 2009 12:07
domain.com & www.domain.com themoose General 4 27th November 2007 23:01
www.domain.com and domain.com patfee Tips/Tricks/Mods 3 12th November 2007 08:33


All times are GMT +2. The time now is 09:29.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.