Support » Fixing WordPress » How to resolve 403 errors after setting pretty permalinks

  • Resolved starapple

    (@starapple)


    I have installed some WordPress sites on my Ubuntu machine at home and in one site have run into a problem with 403 errors on all permalink settings except plain. It is hard to determine whether the issue is caused by Apache’s redirection config or permissions set on WordPress files. The error is:

    Forbidden
    You don’t have permission to access this resource.
    Apache/2.4.46 (Ubuntu) Server at http://www.thelearningcentres.net Port 443

    I am tempted to believe that the matter pertains to redirection because I’m assuming that if a page doesn’t display because of file permissions it should not matter if the file is referred to, as for example, page_id=12 or courses.

    thelearningcentres.com.conf contains:

    <Directory "/path to/public_html">
    Options -FollowSymLinks +SymLinksIfOwnerMatch
            AllowOverride All
            allow from all    
            Options None
            Require all granted
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =www.thelearningcentres.net [OR]
    RewriteCond %{SERVER_NAME} =thelearningcentres.net
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

    The SSL conf thelearningcentres.net-le-ssl.conf contains:

    <Directory "/path to/public_html">
            Options -FollowSymLinks +SymLinksIfOwnerMatch
            AllowOverride All
            allow from all    
            Options None
            Require all granted
        </Directory>

    I assume that the duplication in the <Directory> block is not the issue because other sites on the sever have the exact same style and work as expected.

    I have set folder permissions to 755 and files to 644 but as noted, if file permissions was the issue it shouldn’t matter the file name.

    This matter seems to keep recurring as a Web search turns up scores of questions on different fora and for every one solved by resetting file permissions, there are 20 with no resolution posted. The Common WordPress Errors page does not even mention it, the closest being the 404 file not found error when images are uploaded following setting pretty permalinks.

    Common WordPress Errors

    I’d really love any help with this and maybe a keen eye will see a conflict in the conf files.

    • This topic was modified 4 months, 2 weeks ago by starapple.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator t-p

    (@t-p)

    403 forbidden means that your browser isn’t able to load the scripts up because your server isn’t allowing it. This is a hard one to solve. Because anything could be blocking the server.

    Hence 403 forbidden error is very vague, the error log may give you clue.
    – Most likely this is a server permissions/ownership issue. If its a permission issue, it may tell you which file has incorrect permissions, so ask your host what’s going on. If you are using cPanel, the following tutorial has more information about the error log in cPane: How to view cPanel Error logs
    – If the problem is file permissions, you can follow the steps in the below article to learn how to modify your file permissions: How to change file permissions within cPanel https://codex.wordpress.org/Changing_File_Permissions
    – Another possible cause could be a corrupt .htaccess file. Also check your .htaccess files for anything strange.
    – make sure your server settings are not overriding the .htaccess file.
    – Another possible cause could be changes to the server settings (accidental or otherwise). Check with your hosting provider.

    Also see this help guide https://www.wpbeginner.com/common-wordpress-errors-and-how-to-fix-them#403forbidden

    Thread Starter starapple

    (@starapple)

    @t-p, itseems you only read the heading.

    Thread Starter starapple

    (@starapple)

    The problem was “fixed” after I compared another working ssl.conf file generated for another virtual host on the same server by Let’s Encrypt. I noticed the functioning config did not contain the line “Options None”.

    I commented the line (# Options None), reloaded Apache and then set permalinks to Post name. Bingo, the pages loaded correctly. Is this the solution or just a fix? I don’t know but it certainly adds to the myriad of recommendations around the Web. One more possible but maybe not probable cause for permalink 403 errors.

    • This reply was modified 4 months, 2 weeks ago by starapple.
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.