I just install wordpress in new ec2 in amazon with SSL certificate, when I try connect to admin section I see this error “Sorry, you are not allowed to access this page.”
here my code of .htaccess

`# BEGIN WordPress
 <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - 

[L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php 

[L]
</IfModule>

# END WordPress
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{SERVER_PORT} 443
  RewriteRule ^(.*)$ https://.......com/$1 [R,L]

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://.......com/$1 [R=301,L]

</IfModule>

`

My config.php
`

$table_prefix  = 'dz56nx1349_';

define('WP_HOME', 'https://.......com');
define('WP_SITEURL', 'https://.......com');
/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the Codex.
 *
 * @link https://codex.wordpress.org/Debugging_in_WordPress
 */
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', true);
@ini_set('display_errors', E_ALL);

/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');


if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false){
    $_SERVER['HTTPS']='on';
}`

in the debug.log I have this error
Undefined index: HTTP_X_FORWARDED_PROTO in /var/www/html/wp-config.php on line 95

Read more here: "Sorry, you are not allowed to access this page." wordpress fresh install


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: