I've tried masking the domain and redirecting the site 301 and I haven't been able to get the URL to not show www.site.com/moodle/ can anyone please help? I don't want it to show the /moodle/ part at the end.
I've gone through the other three or four sites that I've wanted to do this to as well and it has worked for those, so I can't figure out what I'm missing but obviously I'm forgetting some step. Please let me know if there is any pointers you guys know of that might assist.
Thank you!!
Hi,
Much depends on whether you are on a dedicated server (unlikely for external hosting except for very big sites) or a shared server (shared hosting - very probable).
On a shared host you almost certainly require your web host to set up a pointer for you, it is very improbable that you would have control over this. This pointer (www) would take the user into the moodle (or public_html) folder and open index.php so that...
www.mysite.com opens www.mysite.com/moodle/index.php [or similar using public_html]
Everything else then relies on config.php which has 3 lines in it to sort out the redirection...
$CFG->wwwroot = 'http://www.mysite.com' ;
$CFG->dirroot = '/home/myinternalname/moodle' ;
$CFG->dataroot = '/home/myinternalname/data' ;
or perhaps,
$CFG->wwwroot = 'http://www.mysite.com' ;
$CFG->dirroot = '/home/myinternalname/public_html' ;
$CFG->dataroot = '/home/myinternalname/moodledata' ;
/home/myinternalname/ is a the topmost folder you can reach on your shared server, and plainly the rest of each URL has to match what you see.
If setting up config.php this way does not solve the problem. Speak to your web host!
Regards,
John
Much depends on whether you are on a dedicated server (unlikely for external hosting except for very big sites) or a shared server (shared hosting - very probable).
On a shared host you almost certainly require your web host to set up a pointer for you, it is very improbable that you would have control over this. This pointer (www) would take the user into the moodle (or public_html) folder and open index.php so that...
www.mysite.com opens www.mysite.com/moodle/index.php [or similar using public_html]
Everything else then relies on config.php which has 3 lines in it to sort out the redirection...
$CFG->wwwroot = 'http://www.mysite.com' ;
$CFG->dirroot = '/home/myinternalname/moodle' ;
$CFG->dataroot = '/home/myinternalname/data' ;
or perhaps,
$CFG->wwwroot = 'http://www.mysite.com' ;
$CFG->dirroot = '/home/myinternalname/public_html' ;
$CFG->dataroot = '/home/myinternalname/moodledata' ;
/home/myinternalname/ is a the topmost folder you can reach on your shared server, and plainly the rest of each URL has to match what you see.
If setting up config.php this way does not solve the problem. Speak to your web host!
Regards,
John
A bit clunky, what aboout a meta redirect.
Create a page in the root of your domain with only the following info:
<meta http-equiv="refresh" content="2;url=http://xys.com/moodle">
It's worked for me
PAul
Create a page in the root of your domain with only the following info:
<meta http-equiv="refresh" content="2;url=http://xys.com/moodle">
It's worked for me
PAul
I am not clear on whether you WANT to redirect or you just want your moodle to respond at www.mydomain.com.... It is easy enough to do the last bit without any apache magic ;=}
While moodle is zipped with moodle as a parent directory (which can be irritating at times) you can get rid of the moodle directory and install moodle in your root if you want. You can also create a subdomain and install moodle in the root of it.... so for example you could have a mydomain.com with Drupal installed in that root and a link from drupal to your subdomain moodle.domain.com
This can all be addressed in how you set your config.php as well as how you set up apache as apache's conf files let you specify what is going to respond and how...... in other words, you could install moodle in the /moodle directory in the apache doc root and then actually change the apache doc root to /moodle!
But what you can do and how you can do it depends on how much control you have over your web server and moodle installation and what you actually want to accomplish......
While moodle is zipped with moodle as a parent directory (which can be irritating at times) you can get rid of the moodle directory and install moodle in your root if you want. You can also create a subdomain and install moodle in the root of it.... so for example you could have a mydomain.com with Drupal installed in that root and a link from drupal to your subdomain moodle.domain.com
This can all be addressed in how you set your config.php as well as how you set up apache as apache's conf files let you specify what is going to respond and how...... in other words, you could install moodle in the /moodle directory in the apache doc root and then actually change the apache doc root to /moodle!
But what you can do and how you can do it depends on how much control you have over your web server and moodle installation and what you actually want to accomplish......
As others have pointed out, a lot depends on the amount of control you have over your hosting account.
If you're on a shared hosting account and your hosting company allows you to turn on URL re-writing in your .htaccess file, put the following code at the top of your top-level .htaccess file:
# Turn on URL re-writing
RewriteEngine On
# Rewrite base to strip leading /
RewriteBase /
# Redirect root dir to Moodle top page
RewriteRule ^$ /moodle/index.php [L]
# Skip existing non-Moodle files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Re-write Moodle files/directories
RewriteCond %{DOCUMENT_ROOT}/moodle/%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}/moodle/%{REQUEST_URI} -d
RewriteRule ^(.*)$ /moodle/$1 [L]
Be sure to save your existing .htaccess file before making any changes, just in case something goes wrong
.
Cheers,
Muyi
If you're on a shared hosting account and your hosting company allows you to turn on URL re-writing in your .htaccess file, put the following code at the top of your top-level .htaccess file:
# Turn on URL re-writing
RewriteEngine On
# Rewrite base to strip leading /
RewriteBase /
# Redirect root dir to Moodle top page
RewriteRule ^$ /moodle/index.php [L]
# Skip existing non-Moodle files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Re-write Moodle files/directories
RewriteCond %{DOCUMENT_ROOT}/moodle/%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}/moodle/%{REQUEST_URI} -d
RewriteRule ^(.*)$ /moodle/$1 [L]
Be sure to save your existing .htaccess file before making any changes, just in case something goes wrong

Cheers,
Muyi
Wow, by far the best reply numbers I've gotten to any question in the forums so thank you to all!
The domain is hosted on a shared server. For other sites I was always able to simply change the masking through GoDaddy and it changed the URL. I'm going to go through the responses and see what does and doesn't work and I'll get back to you.
thanks,
Brett
The domain is hosted on a shared server. For other sites I was always able to simply change the masking through GoDaddy and it changed the URL. I'm going to go through the responses and see what does and doesn't work and I'll get back to you.
thanks,
Brett
I am working through the same problem (at least I think it is the same problem)...
my moodle sit was working fine, accessing it through my isp ip address/moodle. Then I added godaddy registered domain name.. and used url forwarding... again, my moodle site worked fine...
when I then added masking through godaddy, users were prevented from logging in. the initial page displays fine, and I can get to the login screen, but when trying to log in, you get an error message that "cookies are not allowed on my pc"... but of course, if I go back to godaddy and turn off masking, the site works fine again...
would appreciate any additional suggestions..
John
my moodle sit was working fine, accessing it through my isp ip address/moodle. Then I added godaddy registered domain name.. and used url forwarding... again, my moodle site worked fine...
when I then added masking through godaddy, users were prevented from logging in. the initial page displays fine, and I can get to the login screen, but when trying to log in, you get an error message that "cookies are not allowed on my pc"... but of course, if I go back to godaddy and turn off masking, the site works fine again...
would appreciate any additional suggestions..
John