how to redirect mysite.com to moodle directory

how to redirect mysite.com to moodle directory

by N W -
Number of replies: 2

Hello

I have been trying various means of redirecting a web address to /moodle site page, with no success. I've installed moodle3.9 on a VPS, via command prompt. 

How do I set up a permanent server redirect? to the Moodle directory from a web address?

These .htaccess files don't work, but I'm not sure why.

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} moodle
RewriteRule ^(.*)$ http://www.mysite.com/moodle/$1 [R,L]
or
Redirect 302 / http://example.com/moodle

Perhaps it is easier via Ubuntu ?
Would anyone be kind enough to point me in the right direction please?



Average of ratings: -
In reply to N W

Re: how to redirect mysite.com to moodle directory

by Ken Task -
Picture of Particularly helpful Moodlers
Is your site running nginx rather than apache? If so, nginx doesn't use .htaccess.
Question ... why do you want to do this? Guessing that your command line install of moodle stuck code in /moodle/ and that has prompted you to look into redirects.
There is another way .... auto forwarding index.html and/or index.php pages at apache or nginx document roots do same thing.
Google for that and you'll find what seek ... but here's one:
https://www.bluehost.com/help/article/php-redirect
'SoS', Ken
Average of ratings: Useful (1)
In reply to Ken Task

Re: how to redirect mysite.com to moodle directory

by N W -
Thanks Ken!