After login get “403 Forbidden”

I have set up WordPress on my computer, installed in /var/www/localhost/htdocs and eventually got the admin page and entered a username and a password.

This is my wp-config.php (I have taken out the MySQL password and the longer comments):

/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );

/** MySQL database username */
define( 'DB_USER', 'root' );

/** MySQL database password */
define( 'DB_PASSWORD', '?xxx?' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

/** MySQL socket */
define( 'DB_HOST', 'localhost:/var/run/mysqld/mysqld.sock' );

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define( 'AUTH_KEY',         'put your unique phrase here' );
define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
define( 'NONCE_KEY',        'put your unique phrase here' );
define( 'AUTH_SALT',        'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
define( 'NONCE_SALT',       'put your unique phrase here' );
/**
/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix = 'wp_';

define( 'WP_DEBUG', true );
define('WP_DEBUG_LOG',true);

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

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
        define( 'ABSPATH', __DIR__ . "https://wordpress.stackexchange.com/" );
}

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

I can login using
http://localhost/wp-login.php
but after that I get “403 Forbidden” — I have set debug on in the hope of further information but I cannot find a log file.

I hope you can help me… (sorry, can’t find an appropriate tag)

2 Answers
2

A 403 error is usually caused by either a plugin, a corrupt .htaccess file (this isn’t the case since the installation is local) or wrong permission on crucial files. If you are running Linux, try to run this in your local shell:

find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

Leave a Comment