Use subdomain as (readonly) repository

Use subdomain as (readonly) repository

by poorya md -
Number of replies: 4

Hi,

Is it possible to use a subdomain as a (readonly) repository?

I have (a/another) fast download hosting and I put my video files there so that my server which is low in space, does not fill with videos. I did restricted direct access to files so they are only accessible inside my Moodle.

I'm thinking that if I need to change base url of my download server, (for example from dl.site.com to dl2.site.com), I will need to change them all. Since I do not have WebDav access to my Download server, I want to know if there is any alternative.


Average of ratings: -
In reply to poorya md

Re: Use subdomain as (readonly) repository

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
I don't think I understand your problem. Are you saying that your Moodle, say http://moodle.example.com, has video content which are delivered from another server, say http://download.example.com, and all that works satisfactorily. Your worry is, if you change the second server in the future, say to http://download2.example.com, how to handle the hardcoded links to http://download.example.com, correct?

In that case the script behind http://moodle.example.com/admin/tool/replace/ could be a quick solution.

Warning: That script will display a big warning. Take it seriously.
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Use subdomain as (readonly) repository

by poorya md -

You exactly understood my problem.

Thank you for your response. That is a good solution that I did not know about.


But, I was thinking if there is a filter or something like that, to handle this on the fly. So it would be safer than DB manipulation and easier to do and undo.


In reply to poorya md

Re: Use subdomain as (readonly) repository

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
I'm glad that it helped.

About the "filter": No, the old URLs in the DB need to be replaced with the new URLs. So it is a DB manupulation whatever the method you use. If you are comfortable with dumping the DB, do a text search-and-replace and feed the dump back in to the DB, you can do just that.

Having said that, a https://docs.moodle.org/en/Filter could do the same on-the-fly as you say. To my knowledge there is no ready-made one.