URL site redirection

URL site redirection

Genner Cerna
Vastuste arv 9

Anyone knows on how to redirect a url?

Example when people browse for http://www.eclass.adzu.edu.ph I wanted the url returns automatically in the said browser to http://eclass.adzu.edu.ph

How do I do this? just like when you type http://www.moodle.org will give ypu http://moodle.org

Keskmine hinnang: -
Vastuses Genner Cerna

Re: URL site redirection

Paul Hague
There are other ways but I use php for this.

If you have DirectoryIndex set to index.php as well as the usual index.html in Apache you put the following in your index.php file:

<?php header("Location: http://eclass.adzu.edu.ph") ?>

You need to make sure there's no output from this file.
Vastuses Genner Cerna

Re: URL site redirection

Huib van Wees
The same way if you visit http://www.rhino.cx ?
This url redirects to http://moodle.rhino.cx

I did it this way:

In apache I made a virtual server that catches all the request that doesn't belong to another virtual server. Also I use a * record in DNS. (Try type http://whateveritisitalwaysworks.rhino.cx it works really!)

In that virtual server the index.php looks like the attached file. (I can't paste php code here, so I had to attach it.)

And the virtual server moodle.rhino.cx, run actualy the moodle installation.

I'm almost sure that there are other ways to do this, but this also works. silmapilgutus

Hope this helps you.

Maybe Martin can give his moodle.org solution silmapilgutus

Regards,

Huib
Vastuses Huib van Wees

Re: URL site redirection

Genner Cerna

Thanks for the reply, I works! Question: Is this compatible to all browsers?

Martin, how did you do it in moodle.org? Is it the same as said above...

Vastuses Genner Cerna

Re: URL site redirection

Martin Dougiamas
Core developers pilt Documentation writers pilt Moodle HQ pilt Particularly helpful Moodlers pilt Plugin developers pilt Testers pilt
In httpd.conf, make a new virtual server to catch the other addresses, and include this line to redirect them all to the main address:

Redirect  /  http://main.address.com/
Vastuses Martin Dougiamas

Re: URL site redirection

Genner Cerna

Martin, another question? When I type in the url http://www.moodle.org/login it redirect to http://moodle.org/login how do you do this did you define all directory in redirect? What's the trick?

This is the url sample of mine: http://www.eclass.adzu.edu.ph/login/ and i wanted to drop all www and redirect http://eclass.adzu.edu.ph/login/

Thanks...

Vastuses Huib van Wees

Re: URL site redirection

Thamarai Thamarai

HI,

I have installed moodle in 172.22.24.35 IP.It working properly.

My poblem is, how to redirect moodle "172.22.24.35" ip to another "172.24.35.33" ip.

I changed the moodel config.php file  but that was not work.

if i entered the "172.24.35.33" ip in browser it redirect to "172.22.24.35" ip

Any one help to me.....I spent lot of days for that issue.

Here i have attached the screen short.

Kindly find it.