Installing Wordpress in a subdirectory, getting 403 error - wordpress

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>

Related

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

Can't access 2nd Wordpress instance in subdirectory

I've installed a second instance of wordpress in a subdirectory but when I try to access mysite.com/newsite I get a 404 error page on the root wordpress install page/theme. I've looked at the .htaccess files which have rewrite rules, tried adding an exception for the /newsite folder in the root .htaccess but it had no effect.
Can someone help with this?
Did you try this set of instructions? According to that site, the .htaccess in the second installation should look like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /newsite/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /newsite/index.php [L]
</IfModule>
# END WordPress
Try that out if you haven't and let me know if it works.

no permission on wp_admin

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.

wordpress seeing 404 but the files exist?

So my site is loading VERY slowly so I checked it on gtmetrix.com. The results, below, show that several JS files don't exist.
I have manually checked via FTP, the files ARE there. When I check in my browser directly, wordpress gives me the 404 page.
Is this a .htaccess problem? I really don't get it.
https://gtmetrix.com/reports/gonzalezfurniture.net/t6Exkx0i
edit:
below is the htaccess rule:
# 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
Could the problem be that first line after rewriteBase, stopping all other rules?
As it turned out, the child folders inside the plugins folder had various permissions set, which prevented some plugins or specific plugin files from loading.

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