Skip to main content

Error 500 - public_html/.htaccess: <Directory not allowed here

Comments

14 comments

  • cPRex Jurassic Moderator
    Hey there! This error is telling you that you can't use the "Directory" command inside the .htaccess file, so you'll need to remove that code. cPanel also includes the "AllowOverride All" code in the main Apache configuration file, so I wouldn't expect that you need to add that manually to an individual domain. You can add the code you need to the .htaccess file without the Directory tags, as .htaccess is limited to the directory it exists in already.
    0
  • HaNi Ghaith
    Thank you for your answer. I have already tried removing it These are the contents of the .htaccess file now: But this did not fix the problem Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all # php -- BEGIN cPanel-generated handler, do not edit # Set the "ea-php74" package as the default "PHP" programming language. AddHandler application/x-httpd-ea-php74 .php .php7 .phtml # php -- END cPanel-generated handler, do not edit
    0
  • HaNi Ghaith
    After removed Directory I see this error: /home/user/public_html/.htaccess: AllowOverride not allowed here
    0
  • cPRex Jurassic Moderator
    As I thought, since we add that globally, there's no need for that in the .htaccess. There must be some other reason you're getting the 404 page that will need to be investigated.
    0
  • HaNi Ghaith
    I tried to read logs after removing the write rules from the .htaccess file but I don't see any errors except the 404 error that appears on the site. Any suggestions on what to do to determine the cause of this error? I migrated to this server recently and I suspect this has something to do with this issue. So what is the setting in Apache that might cause this kind of problem in your opinion?
    0
  • HaNi Ghaith
    Are there any Apache models that have something to do with this problem? Anyway, I built Apache a few days ago and all the sites are working except for this site that I later transferred to the server.
    0
  • cPRex Jurassic Moderator
    Are there any details about the 404 error in the main Apache log at /etc/apache2/logs/error_log?
    0
  • HaNi Ghaith
    I tried to read logs after removing the write rules from the .htaccess file but I don't see any errors except the 404 error that appears on the site.
    0
  • cPRex Jurassic Moderator
    Do you have root access to the server or only access to the one cPanel account?
    0
  • HaNi Ghaith
    Do you have root access to the server or only access to the one cPanel account?

    I have root access to the server
    0
  • cPRex Jurassic Moderator
    I would expect there to be an entry in the main Apache log for the 404. Can you run this command while generating the 404 page in the browser? tail -f /etc/apache2/logs/error_log
    0
  • HaNi Ghaith
    This is exactly what I did, but I see errors related to another user that has nothing to do with the site that contains the problem. No logs related to error 404 appear. directive --- ignoring! [Mon Sep 12 16:57:46.034597 2022] [core:notice] [pid 29279:tid 47309371021056] AH00113: /home/user/public_html/forum/.htaccess:13 cannot use a full URL in a 401 ErrorDocument directive --- ignoring! [Mon Sep 12 16:57:46.449621 2022] [core:notice] [pid 29768:tid 47309366818560] AH00113: /home/user/public_html/.htaccess:37 cannot use a full URL in a 401 ErrorDocument directive --- ignoring! [Mon Sep 12 16:57:46.449673 2022] [core:notice] [pid 29768:tid 47309366818560] AH00113: /home/user/public_html/forum/.htaccess:13 cannot use a full URL in a 401 ErrorDocument directive --- ignoring!
    0
  • cPRex Jurassic Moderator
    If that is a separate user, then yes, those wouldn't be related. Is there an application-log for that domain, such as a WordPress log or something similar?
    0
  • HaNi Ghaith
    The problem has been fixed I got the .htaccess file from the script programmer and it worked as requested. Thank you for your cooperation
    0

Please sign in to leave a comment.