Hotlinking issue - .htaccess not updating

nightaddix

Active Member
PartnerNOC
Jul 7, 2008
30
0
56
Hello,

One of our customers has an issue using hotlink protection. The problem is that hotlink protection is enabled and if a new domain is added to the list of allowed domains, the .htaccess file doesn't get updated. Nothing happens and there is no error shown in the cPanel interface itself. However, checking cPanel's error log - /usr/local/cpanel/logs/error_log, the following messages are getting displayed :

Cpanel::IxHash: Warning, mangling data key urls which is longer than 64 bytes, using safe_html_encode
Cpanel::IxHash: at /usr/local/cpanel/Cpanel/ExpVar.pm line 405
Cpanel::ExpVar::expvar('$FORM{\'urls\'}', 0, 1, 0) called at cpanel line 1459
main::parsetag('Mime="add_hotlink($FORM{\'urls\'},$FORM{\'exts\'},$FORM{\'rurl\'...', undef) called at cpanel line 1091
main::real_exectag('<cpanel Mime="add_hotlink($FORM{\'urls\'},$FORM{\'exts\'},$FORM{...') called at cpanel line 3876
main::dotag_finished_headers(1) called at cpanel line 3704
main::cpanel_parseblock('<cpanel setvar="headerimg=../images/tools.gif">^J<cpanel setvar="...') called at cpanel line 3612
main::cpanel_parse('GLOB(0xa929338)') called at cpanel line 5121
main::run_standard_mode() called at cpanel line 424
Cpanel::IxHash: Warning, mangling data key urls which is longer than 64 bytes, using safe_html_encode
Cpanel::IxHash: at /usr/local/cpanel/Cpanel/ExpVar.pm line 405
Cpanel::ExpVar::expvar('$FORM{\'urls\'}', 0, 1, 0) called at cpanel line 1465
main::parsetag('print="$FORM{\'urls\'}"', undef) called at cpanel line 1091
main::real_exectag('<cpanel print="$FORM{\'urls\'}">') called at cpanel line 3876
main::dotag_finished_headers(0) called at cpanel line 3704
main::cpanel_parseblock('<cpanel setvar="headerimg=../images/tools.gif">^J<cpanel setvar="...') called at cpanel line 3612
main::cpanel_parse('GLOB(0xa929338)') called at cpanel line 5121
main::run_standard_mode() called at cpanel line 424
Cpanel::IxHash: Warning, mangling data key urls which is longer than 64 bytes, using safe_html_encode
Cpanel::IxHash: at /usr/local/cpanel/Cpanel/ExpVar.pm line 405
Cpanel::ExpVar::expvar('$FORM{\'urls\'}', 0, 1) called at cpanel line 3261
main::doprint('$FORM{\'urls\'}', 0) called at cpanel line 1169
eval {...} called at cpanel line 1169
main::real_exectag('<cpanel print="$FORM{\'urls\'}">') called at cpanel line 3876
main::dotag_finished_headers(0) called at cpanel line 3704
main::cpanel_parseblock('<cpanel setvar="headerimg=../images/tools.gif">^J<cpanel setvar="...') called at cpanel line 3612
main::cpanel_parse('GLOB(0xa929338)') called at cpanel line 5121
main::run_standard_mode() called at cpanel line 424

The permissions / ownership for .htaccess are correct and we have tried running /scripts/upcp --force but the issue didn't get fixed. Any insights / suggestions that you can provide are welcome. Thanks in advance.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
38
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
When cPanel > Hotlink Protection is enabled, the script runs through every single .htaccess on the account for addon and subdomains not only the main domain. If it cannot read the .htaccess on any of those addon or subdomains, it will fail with the error you are seeing. You can run a check on each .htaccess file on the account using this command in root SSH:

Code:
/usr/local/apache/bin/httpd -DSSL -t -f /home/username/public_html/pathtohtaccess
Please replace username with the cPanel username and pathtohtaccess to the path for the .htaccess (so if it is in a subdomain folder, the full path to that .htaccess for the subdomain). If you get any errors on running that command, then that .htaccess is the issue. Simply move it out of the way and re-try adding Hotlink Protection.
 

nightaddix

Active Member
PartnerNOC
Jul 7, 2008
30
0
56
Hello,

I wanted to update this post in case anyone else runs into this problem as it appears to have been indeed caused by some malformed .htaccess entries.

Thanks.