• Hello,

    I have a WordPress site deployed to Heroku, it’s running smoothly for the most part when paired with the heroku/php buildpack.

    The problem comes from trying to access the wp-admin, or admin dashboard. I get the message “Sorry, you are not allowed to access this page”.

    Here are some specific details:
    .htaccess

    
    # BEGIN WordPress
    
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
    </IfModule>
    
    # END WordPress
    

    wp-config.php

    
    define('FORCE_SSL_ADMIN', true);
    
    if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
    	$_SERVER['HTTPS'] = 'on';
    
    define( 'WP_DEBUG', true );
    

    Heroku App

    
    - php (7.4.6)
    
    - apache (2.4.43)
    
    - nginx (1.18.0)
    

    Database
    JawsDB Maria

    I’ll appreciate any suggestion to fix the problem.

    Thank you,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello- give this a try and see if it proves helpful

    Try manually resetting your plugins (no Dashboard access required). If that resolves the issue, reactivate each one individually until you find the cause.

    If that does not resolve the issue, access your server via SFTP or FTP, or a file manager in your hosting account’s control panel, navigate to /wp-content/themes/ and rename the directory of your currently active theme. This will force the default theme to activate and hopefully rule-out a theme-specific issue (theme functions can interfere like plugins).

    Thread Starter alphonso06

    (@alphonso06)

    Hello- give this a try and see if it proves helpful

    Try manually resetting your plugins (no Dashboard access required). If that resolves the issue, reactivate each one individually until you find the cause.

    If that does not resolve the issue, access your server via SFTP or FTP, or a file manager in your hosting account’s control panel, navigate to /wp-content/themes/ and rename the directory of your currently active theme. This will force the default theme to activate and hopefully rule-out a theme-specific issue (theme functions can interfere like plugins).

    Hey, thanks for the reply!

    I’m running plain wp with no plugins. And from my experience with Heroku, I’m fairly certain they don’t have FTP of any kind due to how they don’t expose any IP. Even domain names are settled differently.

    As for themes, I’m running Twenty-twenty, the default one that came with the 5.4.1 install.

    Here’s some additional information that I forgot to provide above:
    composer.json

    {
        "scripts": {
            "compile": [
                "chmod -R 777 wp-admin/",
                "chmod -R 777 wp-content/",
                "chmod -R 777 wp-includes/",
                "chmod -R 777 media/"
            ]
        }
    }

    The build logs of Heroku tell me the script above succeeds, so I’m thinking this isn’t a file directory permissions problem. But I could be wrong.

    I will continue my investigation and post here whatever solution I can come across. Suggestions are always appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[HEROKU] Unable to access wp-admin’ is closed to new replies.