Moodle adds "www" then says it can't access the site.

Moodle adds "www" then says it can't access the site.

by Jason De Donno -
Number of replies: 12

We are testing out a site, and our site name is http://test.aspero.nu/moodle

When users click on the URL, and press enter to go to the site, Moodle adds "www" to the beginning of the address, and gives an error meassage that says "the site can only be accessed by http://test.aspero.nu/moodle" (in other words it adds www then doesn't like it!!!!!).

Does anyone know what is causing the www to appear?

 

Average of ratings: -
In reply to Jason De Donno

Re: Moodle adds "www" then says it can't access the site.

by Guillermo Madero -

Open your config.php file (it's in the main moodle folder) and look at the value of the $CFG->wwwroot parameter.

Average of ratings: Useful (1)
In reply to Guillermo Madero

Re: Moodle adds "www" then says it can't access the site.

by Charlie Marklwick -

We get something similar, the domain responds when either www.thedomain.co.uk or thedomain.co.uk is entered. In this case when a user enters thedomain.co.uk they get the message and then they are diverted to www.thedomain.co.uk is there anyway of preventing this as users find it off-putting? Ideally the Moodle should load when either is typed.

In reply to Charlie Marklwick

Re: Moodle adds "www" then says it can't access the site.

by Alex Saavedra -

Charlie,

I suggest having 2 separate moodle sources (/var/www/moodle and /var/www/moodle2), so one config.php points to thedomain.co.uk, and the second to www.thedomain.co.uk.

However, a user inserting an image with TinyMCE wil have href or src properties set as http://www.thedomain.co.uk or http://thedomain.co.uk, depending on where he/she logged in. (Is there a way to prevent relative URLs to be rewritten as absolute ones by TinyMCE?)

Thus, some elements will not show up for all users. Quite annoying.

A. Saavedra

In reply to Alex Saavedra

Re: Moodle adds "www" then says it can't access the site.

by Brian Lockwood -

Would it not be much better that any dns issues are dealt with via your local DNS (if there is one) or .htaccess before any complexities occur with configuring Moodle?

In reply to Brian Lockwood

Re: Moodle adds "www" then says it can't access the site.

by Ken Task -
Picture of Particularly helpful Moodlers

Personal approach ...

Yes, that's exactly what is being suggested.  If one knows the Moodle is to be accessed from the globe, setting up local DNS first with the same fully qualified domain name that will eventually be in the outside/public DNS will assure no issues with install, development of content (links to images as an example), etc.  Same is true of remotely hosted IF provider will allow setup of a DNS entry BEFORE a service/server is actually present and responding.

Installation creates the config file from how one accesses the Moodle upon installation.  Documentation for installing on Windows shows checking via http://localhost ... which will work on any machine, but if that's how it was installed, that's what gets written in the config.php file.

Probably best, once the Moodle is ready to install, to finish the installation from a work station as that would force the use of DNS.

Moodle uses full addressing when linking to images and other content.  So if DNS is setup in advance of install and especially before development of content, then there will be fewer issues in bringing up a new server.

If entity not ready for public access, then port 80 is not opened to the internal machine until it is ready for public viewing.

All platforms have a 'cheat' to DNS.  All know that the loopback address (127.0.0.1) is localhost.  Windows still has lmhost and can be told to check that file first before making queries to DNS.  Linux and MacOSX have a host file which can contain other IP addresses with fully qualified domain names of other servers.  In Linux, think most distros have DNS resolving setup to check the host file first, then make queries of whatever DNS server it's pointed to.  Think the same is true of MacOSX.

Have used the above approach for installing 'oodles' of Moodles and it's proven, for me, to be the 'better' approach.

'spirit of sharing', Ken

In reply to Charlie Marklwick

Re: Moodle adds "www" then says it can't access the site.

by Guillermo Madero -

As Moodle works with one address, you could use .htaccess redirection for the other case.

In reply to Charlie Marklwick

Re: Moodle adds "www" then says it can't access the site.

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
A domain is a domain, a host is a host.

thedomain.co.uk is your domain, something.thedomain.co.uk is a host. (Well, it could be a subdomain, in that case something.subdomain.thedomain.co.uk is a host.)

The URL has a hostname following the double slash.
In reply to Charlie Marklwick

Re: Moodle adds "www" then says it can't access the site.

by Ken Task -
Picture of Particularly helpful Moodlers

The real issue is DNS.  There is a domain 'shortcut' that does NOT include a hostname in front that happens to be pointed to www.tld.  Seems most providers assume a web site and not anything else would be at the root of a web space.  Moodle requires a url (a fully qualified domain name - that can be looked up via DNS) in it's config.

Ever plan on hosting a different site/app at the root of your web space at the domain.tld?  Then one might be re-visiting this very same issue again.

Advise 'fixing' the DNS! ;)

However, besides .htaccess one could also have an auto-forwarding index.html at the root of the space which forwards to the same URL as entered in the Moodle config.

2 cent contribution to the discussion. ;)

'spirit of sharing', Ken

 

'spirit of sharing', Ken

In reply to Ken Task

Re: Moodle adds "www" then says it can't access the site.

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Ken

You said:
> The real issue is DNS.

There is more to it. The moodle.org glossary, which convert so many words to links, says:

Domain, A name given to a computer or a group of computers. eg moodle.org. You can buy new domain names from a domain name registrar, of which there are many.

That must be the reason why people believe that the _domain_ responds when you request an URL!

From Wikipedia:
Domain name, a common network name under which a collection of network devices are organized (e.g., example.com). http://en.wikipedia.org/wiki/Domain.
Details here http://en.wikipedia.org/wiki/Domain_name.
In reply to Visvanath Ratnaweera

Re: Moodle adds "www" then says it can't access the site.

by Ken Task -
Picture of Particularly helpful Moodlers

There has always been confusion with the term "domain" as it also applies to a LAN or WAN (as you've referenced) as opposed to Internet domains.  It's meaning, of course, dependent upon the context in which used.  DNS has always been 'magic' and served out from one of those 'black boxes' that most users of Internet are totally un-aware ... cept when queries fail and users can't access desired resource.

Just checked directions for installing on Windows:

http://docs.moodle.org/22/en/Complete_install_packages_for_Windows

Didn't see any reference or mention of DNS IF the server to be accessible via the Internet - unless I missed it.

In setting up a new Moodle server that will be accessed via the Internet one of the very first steps should be setting up a DNS entry for the server - before the installation begins (IMHO).   That applies to folks who have chosen remotely hosted as well.

'spirit of sharing', Ken

In reply to Ken Task

Re: Moodle adds "www" then says it can't access the site.

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Ken

You wrote:
> There has always been confusion with the term "domain"

Sure. In fact the first reference I gave, http://en.wikipedia.org/wiki/Domain, was the disambiguation page for over 50 uses of the term "domain"!

> as it also applies to a LAN or WAN (as you've referenced) as opposed to Internet domains.

No. The second referece, http://en.wikipedia.org/wiki/Domain_name, was as the term applies to Internet domains.

> Just checked directions for installing on Windows:
> http://docs.moodle.org/22/en/Complete_install_packages_for_Windows
> Didn't see any reference or mention of DNS IF the server to be accessible via the Internet - unless I missed it.

DNS is above the operating system. So the starting page should be http://docs.moodle.org/en/Installing_Moodle. You are right, DNS is not mentioned there.

> DNS has always been 'magic' and served out from one of those 'black boxes' that most users of Internet are totally un-aware ... cept when queries fail and users can't access desired resource.

This article goes into the topic hosting: http://docs.moodle.org/en/Finding_and_Selecting_A_Web_Host. Even there no mention of DNS or domain. This indeed seems to be 'magic'.
;-(