Support

Admin Tools

#15152 Moodle doesn't load CSS/Template - Non-www to www

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by nicholas on Wednesday, 27 February 2013 04:15 CST

user71441

Hi,

I already asked about this problem, and it was solved: https://www.akeebabackup.com/support/admin-tools/15013-fixed-permissioins-but-moodle-doesnt-load-csstemplate.html

Go to .htaccess Maker and add:

portal

to "Allow direct access, including .php files, to these directories", then click on Save and Create .htaccess.

But, after I choose "Redirect non-www to www", the same problem occurs. Is it possible to redirect non-www to www without this problem?

Thanks in advance!

Best regards,

Filip

nicholas
Akeeba Staff
Manager

Hello Filip,

My guess is that Moodle stores the URL to your site somewhere and it doesn't contain the www part of the domain name. The only workarounds are either disabling that option in .htaccess Maker (you can enable the www to non-www redirection) or find out where Moodle stores that information and change it. Unfortunately, I have never used Moodle and can't tell you exactly what's required :(

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user71441

Hi Nicholas,

In Moodle dirroot there is config.php - in that file there is line:

$CFG->wwwroot = 'http://mysite.com/portal';

I have added www, so now it looks like: $CFG->wwwroot = 'http://www.mysite.com/portal';

After that, there is no problem with redirection of non-www to www... but, now subdomain does not work - when I enter:

(If I enter with www (www.portal.mysite.com), everything is fine. If I delete .htaccess - there are no problems at all. If I create .htaccess without redirecting non-www to www, also everything is ok.)

Since this is about MOODLE, it's okay and I will understand if you don't answer, but if you have any suggestion, advice, idea... I would be much grateful to you! :)

Thank you!

Best regards,

Filip

Β 

Β 

nicholas
Akeeba Staff
Manager

I don't want to speculate about a web application (Moodle) I am not at all familiar with and haven't even used myself. I know how Joomla! works inside out, but Moodle is a black box to me.

That said, I believe that this problem is something I can help you with:

After that, there is no problem with redirection of non-www to www... but, now subdomain does not work - when I enter:

portal.mysite.com (without www) - it redirects to www.portal.mysite.com/portal/ (/porta/ is added?)

Your subdomain's root folder is inside your main site's folder. .htaccess files are inherited from the parent FILESYSTEM directories. This means that your main site's .htaccess is applied in you Moodle installation. FYI, it's documented and resolved in https://www.akeebabackup.com/documentation/troubleshooter/atsubdomains.html

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user71441

OK, thanks Nicholas. I already have portal in "Allow direct access, including .php files, to these directories", so this means that I will need to set RewriteEngine OffΒ in Moodle .htaccess file. If I understood correctly, that this means that I risk to "kill" SEF URLs and maybe some other things can occur... so, I will just disable redirecting. That is the simplest solution, no headaches :) Btw, before your last post here, I have asked on Moodle forum about this problem... my mistake, I'll reply there that I will not use redirect...

Again, Thank you very much Nicholas!

All the best,

Filip

Β 

nicholas
Akeeba Staff
Manager

Yes, in order to avoid adding the www. in front of the subdomain you either have to move the subdomain's root outside the main site's folder (recommended), disable the redirection (OK, that will work) or use a .htaccess with RewriteEngine off in Moodle's directory (killing SEF URLs in Moodle).

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!