1

I've setup a brand new CentOS 7 VPS; everything configured by me. LAMP installation and the Apache virtual host configurations are all done. I've checked them before installing Wordpress and the HTML sites were being showed as well as the PHP info and everything else.

After that I went on to setup Wordpress as usual. Then I tried to log-in(the log-in page got loaded successfully) but the log-in page directed me to an error message of 403 Forbidden: You don't have permission to access /wp-admin/ on this server.

What seems to be the issue? I've a separate user than root managing the VPS whom also has root privileges and it also has ownership on the Wordpress files. Also the files and folder all have 755 as their permissions. Is this a .htaccess issue?

A detailed explanation would be much appreciated. Thanks.

P.S. Also my firewall is not yet installed

  • Remove .htaccess and try accessing website again. – Nick Jul 13 '15 at 5:48
  • @Nick I haven't defined any .htaccess files. Should I go look out for any other defined by some system processes. – Can Sürmeli Jul 13 '15 at 5:49
  • WordPress creates it automatically. It must be in root folder. – Nick Jul 13 '15 at 5:51
  • @Nick Yup, there was one there. But it was empty. Anyway, I deleted it, restarted Apache and nothing changed unfortunately. :( – Can Sürmeli Jul 13 '15 at 5:53
  • I added a code below in answer. Paste this in your .htaccess file. Make sure you use nano or vi on server. – Nick Jul 13 '15 at 5:56
4

Add this in your .htaccess file at website root folder. If you deleted it then create it again and paste this.

DirectoryIndex index.html index.php

# 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

EDIT

Looks like you have issue with DirectoryIndex. In your httpd.conf search for DirectoryIndex and make sure you add index.php in it. Or in your virtual host configuration.

Like this.

DirectoryIndex index.html index.htm index.php
  • Seen it before. Tried it again with no luck. This problem is really bugging me. Thanks. – Can Sürmeli Jul 13 '15 at 5:57
  • Try one more thing. Open www.yourdomain.com/index.php in browser and see if it redirects to www.yourdomain.com/ or you get 403 error on www.yourdomain.com/index.php page itself. – Nick Jul 13 '15 at 6:00
  • Gave an error of 403 again. – Can Sürmeli Jul 13 '15 at 6:01
  • Did you read my comment correctly? It will give 403 error but what is the URL now. Is it www.yourdomain.com/index.php or www.yourdomain.com/? – Nick Jul 13 '15 at 6:02
  • 1
    Then WordPress is working fine and you need to set directory's default index file with DirectoryIndex. I edited the answer with more info. – Nick Jul 13 '15 at 6:08
0

I had two directory callouts to the same directory. one was placed in the regular httpd.conf file and the other was in my virtual host conf. As soon as I deleted the one in the regular conf, my virtual host wp-admin began working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.