no permission on wp_admin - wordpress

I installed the latest version of wordpress in my hosting server. How ever I was not able to add any media. I checked the server space and I have still of huge free space. And then I try to access settings --> media , I got this error
You don't have permission to access /wp-admin/ on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
I added the this into my .htaccess file but still no luck
# BEGIN WordPress
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
<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
Any ideas?
-Alan-

You must download Filezilla and put permissions 755 on every WP file inside your hosting. Also, if this don't work, try to remove all plugins, maybe some plugin is causing the problem.

Related

Synology Personal Websites htaccess results in 403 errors

Synology Server with DSM 7.1.x (recently updated from DSM 6.x and downgrading back down to DSM 6.x is not recommended by Synology)
Webstation Enabled with HTTP back-end server: Apache HTTP Server 2.4 and PHP:
PHP 8.0
Personal Websites with these settings HTTP back-end server: Apache HTTP Server 2.4 and
PHP: PHP 7.4
Personal Websites use WordPress 5.x or 6.x which require a .htaccess file
Problem: Personal Website .htaccess in /homes/user/www folders causes the 403 error
Could delete .htaccess to stop 403 error but Personal Websites use WordPress which requires .htaccess - cannot just delete this file because some WordPress actions recreates the .htaccess file (such as changing Settings > Permalinks)
Newly created test user case: tmp
homes/tmp/www folder has "users" group with 775 permissions
homes/tmp/www/.htaccess has owner of "username" and group of "users" with 770 permissions
homes/tmp/www/wp-config.php has owner of "username" and group of "users" with 770 permissions
Even with permissions of 777 for ALL files in homes/tmp/www, the 403 error still exists with .htaccess
After deleting the .htaccess and creating/publishing a new page, viewing the new page results in a 404 error.
Default .htaccess lines
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /~username/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~username/index.php [L]
</IfModule>
Even if .htaccess has no lines of code at all, the 403 error exists. So just the existence of the .htaccess file regardless of content causes a 403 error.
Anyone have ideas to solve this problem?
Solution I stumbled upon:
Edit the httpd2x.conf for Apache2.x (whichever is chosen for Personal Websites)
Add the following code
UserDir www
<Directory "var/services/homes/*/www">
Options FollowSymLinks
AllowOverride All
</Directory>
I tried a bunch of stuff and I think the above was the trick.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /~username/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~username/index.php [L]
</IfModule>
It looks like you are using Apache per-user web directories? If that's the case then /~username is not a physical directory (it's an "alias" to your user directory) and your document root is effectively /~username/ (which really messes with root-relative URL-paths).
In which case, your .htaccess should be like this instead:
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
Note that I've removed the RewriteBase directive altogether.
However, if this is part of the WordPress code block (ie. inside # BEGIN WordPress ... # END WordPress) comment markers then WordPress is going to try and overwrite your changes unless you take additional steps to prevent this.

Installing Wordpress in a subdirectory, getting 403 error

I did a local install of Wordpress by unzipping the install files into MAMP/htdocs/subdirectory and then successfully completing the installation.
There is a complete website in MAMP/htdocs/ (which doesn't use WordPress). When I try to access localhost:8888/subdirectory, I'm getting a 403 error.
I found the cause which is a line in MAMP/htdocs/.htaccess:
DirectoryIndex src/index.php
When I remove this line, the problem is resolved, but, of course, I need this line for the main website to function properly. Is there a workaround to get WordPress working in the subdirectory (maybe by editing the default .htaccess that was installed by WordPress in MAMP/htdocs/subdirectory/.htaccess?)
Post your .htaccess code or you can try the below .htaccess code just the change the sub directory to the folder name
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sub-directory-name
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /sub-directory-name/index.php [L]
</IfModule>

Error 404 on Wordpress while trying to access settings

I recently deleted the .htaccess file from the cPanel. Then Wordpress started showing the 404 Error when I tried to access anything, even the Wordpress settings. I uploaded the .htaccess file back on cPanel, but it's still showing the 404 error and I can't even access the settings.
create .htaccess file in root folder , and paste following code
# 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
following link may be your problem solution.
https://wordpress.org/support/topic/i-destroyed-my-site-default-htaccess

Internal server error 500 wordpress on server alias

I have installed a wordpress site for a client.
The site works fine on local system as well as the test server but not on the live server. The domain is created as an Alias of an existing site. Homepage displays fine but internal pages show blank with a 500 internal server error in Firebug console.
For the past 3 days I've searched and applied all sorts of fixes to .htaccess, code etc but it doesn't seem to fix.
What I've tried:
Uploaded the code and database twice.
Generated .htaccess fresh using permalinks settings of wordpress.(there are no custom rules in my .htaccess)
Set php code to display all errors but there are none, only notices.
Talked with the server hosting guy and got the memory limit increased.
What I've not tried yet:
Persue the client to create a subdomain instead of an alias.
Please suggest any possible fixes. Thanks!
# 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
UPDATE: Issue Resolved: It was a memory issue on the server. Disabling a few resource-heavy plugins pointed me in the right direction.
Have you tried this...
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /put-the-alias-here/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /put-the-alias-here/index.php [L]
</IfModule>
# END WordPress

Wordpress Intalled on a separate directory and .htaccess redirection

I've installed my wordpress site on a separate directory and followed all the steps described here and now I can access my site from my main domain. So, my Wordpress site is installed under: www.mysite.com/wp-site/ and now I can access my site under www.mysite.com, so all is great, exactly what I wanted. Wordpress is making this happen through an .htaccess file it creates that has the necessary code to make the redirection happen (SEE CODE BELOW).
My problem is that I have other directories on my site, such as www.mysite.com/another-directory-unrelated-to-wordpress/ that I cannot access anymore because I believe wordpress and the .htaccess file it created is redirecting everything to the root.
How can I avoid Wordpress from redirecting all my other subfolders and files? Thanks a ton for any ideas or help.
Here is the htaccess file code:
# 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
The way the WordPress .htaccess file works is if an existing file or directory is requested, it does not send the request through WordPress...that's what the !-f and !-d RewriteCond statements do.
So, there is something else going on with your site. Have you used Firebug or any other debugging tool to see what is happening with the request/response?
You could always enable mod_rewrite logging to see if that gives you a clue.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteLog "rewrite.log"
RewriteLogLevel 3
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
A RewriteLogLevel of 5 would give you the most information. Make sure to comment out or remove the RewriteLog* lines when you have figured out the issue.
UPDATE: Check this other SO answer to see if it resolves your issue

Resources