Rewriting a subdomain with mod-rewrite

I have a project that uses the moodle library. I had to change the url from moodle.example.com to learn.example.com due to a client request.

I thought it would be an easy change, but alas, moodle inserts all the links and images into the full URL instead of the relative URL.

Can mod-rewrite be used to point all requests to moodle.example.com to learn.example.com and support the query string?

Example:

I need a request: http://moodle.example.com/course/view.php?id=2&topic=1go to http://learn.example.com/course/view.php?id=2&topic=1.

Is it possible?

Thank,

Josh

+5
source share
2 answers

Try the following rule:

RewriteCond %{HTTP_HOST} =moodle.example.com [NC]
RewriteRule ^ http://learn.example.com%{REQUEST_URI} [L,R=301]
+5
source

apache moodle : http://docs.moodle.org/en/Moodle_migration

, admin/replace.php. moodle .

+1

All Articles