.htaccess and HTML editor conflict !!!!!!!!!!!!!

.htaccess and HTML editor conflict !!!!!!!!!!!!!

by Alaa Elkholy -
Number of replies: 9

Hi,

I have been having problem with HTML editor buttons disappearing on my Moodle site.

I have many Moodle installations on my site.

Moodle installations on addon domains have this problem.

Moodle installations on the main domain work fine.

After days of invistigation I found the problem relies in .htaccess file.

If I delete this file the problem is solved!!

Any idea how to solve this problem without the trade off for security by deleting .htaccess file?

Below is screen capture:

Average of ratings: -
In reply to Alaa Elkholy

Re: .htaccess and HTML editor conflict !!!!!!!!!!!!!

by Mauno Korpelainen -

The main question is then obviously:

Why do you need that .htaccess file?

It is impossible to give any good advice if you don't even tell what's inside the .htaccess file - to be able to say what breaks editor code or why...

In reply to Mauno Korpelainen

Re: .htaccess and HTML editor conflict !!!!!!!!!!!!!

by Alaa Elkholy -

Hi Mauno,

you are absolutely right,

Here is how my .htaccess looks like:

 

RewriteEngine on

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>

order deny,allow

deny from all

allow from all

</Limit>

<Limit PUT DELETE>

order deny,allow

deny from all

</Limit>

AuthName MyMainDomain.com

AuthUserFile /home/MyMainDomain/public_html/_vti_pvt/service.pwd

AuthGroupFile /home/MyMainDomain/public_html/_vti_pvt/service.grp

Options All -Indexes

 

RewriteCond %{HTTP_REFERER} !^http://MyMainDomain.com/.*$      [NC]

RewriteCond %{HTTP_REFERER} !^http://MyMainDomain.com$      [NC]

RewriteCond %{HTTP_REFERER} !^http://www.MyMainDomain.com/.*$      [NC]

RewriteCond %{HTTP_REFERER} !^http://www.MyMainDomain.com$      [NC]

RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

 


In reply to Alaa Elkholy

Re: .htaccess and HTML editor conflict !!!!!!!!!!!!!

by Mauno Korpelainen -

I am not totally sure but I have a feeling that this last ReWriteRule blocks editor toolbar images - did you use some CPanel Hotlink preventing widget etc to create the .htaccess file? Is your moodle otherwise rendering images on courses?

In general, use of .htaccess files should be avoided when possible - they provide an optional way to make configuration changes on a per-directory basis but if your server is otherwise safe and functional this kind of rules can be difficult to control.

Moodle itself is open source code and anybody can download the package from moodle.org so there is nothing to hide - just make sure that your moodledata (or uploaddata) is not directly web accessible.

I would delete that .htaccess file.

 

Average of ratings: Useful (1)
In reply to Mauno Korpelainen

Re: .htaccess and HTML editor conflict !!!!!!!!!!!!!

by Alaa Elkholy -

Dear Mauno,

Your advice was of great help.

Yes the last ReWriteRule line wa causing this problem

I wonder what it exactly does. Also I wonder how this problem just appeared all of sudden given that I did not touch .htaccess file?

In reply to Alaa Elkholy

Re: .htaccess and HTML editor conflict !!!!!!!!!!!!!

by Mauno Korpelainen -

I remember one case from the past where CPanel had some setting that added automatically such .htaccess rules to subdomains and in that case no core images of moodle were seen if some subdomain redirection rule was used - the original domain name worked ok. I think the main reason for such rules is to block some untrusted sites from directly linking images (hotlinking) but preventing own subdomains from linking images on main domain does not sound useful.

It's not your fault anyway - CPanel can have all kinds of settings and this problem (creation of .htaccess file) was most likely caused by one tick in the wrong place in CPanel smile

Average of ratings: Useful (1)
In reply to Mauno Korpelainen

Re: .htaccess and HTML editor conflict !!!!!!!!!!!!!

by Alaa Elkholy -

Dear Mauno,

Your diagnostic fits my issue100%.

Thanks man for your great help, you cleared many mysteries I had.

Wish you the best.

regards

Al

In reply to Alaa Elkholy

Re: .htaccess and HTML editor conflict !!!!!!!!!!!!!

by Stefano Calza -

I have the same problem but I don't have .htaccess in the main installation directory, just one in moodledata (which btw doesn't solve the problem).

Any other hint? I can see some icons, but not sure all are properly rendered. E.g. moodle logo in the URL bar is not right.

Only  thing I did is chmod +x to the whole installation directory...

Stefano

In reply to Stefano Calza

Re: .htaccess and HTML editor conflict !!!!!!!!!!!!!

by Mauno Korpelainen -

Stefano,

you could first recheck if you see some parts of editor toolbar or no toolbar at all. Next you could check the url of one missing image (for example that moodle logo) and tell what it looks like. If it is not directly web accessible (you can't open the image path separately in browser and get file not found etc the problem might be in missing permissions to READ image files (permission to execute does not help) - or some security module (SELINUX etc) might block opening files - or settings (paths) in config.php might be wrong.

Or some other script somewhere on your site might break your editor code...

Moodle 1.9 had about 10 different reasons for missing editor and moodle 2 will probably have about the same amount of different reasons...

In reply to Mauno Korpelainen

Re: .htaccess and HTML editor conflict !!!!!!!!!!!!!

by Stefano Calza -

Uhm...looks like images are corrupted. I can see those saved on my PC but those loaded are just crappy. Very weird. I guess I will reload everything and see if it fixes the problem.

I'll be back!

Thaks

Stefano