Installing Wordpress in a subdirectory, getting 403 error

472 views Asked by At

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?)

1

There are 1 answers

0
raghucw18 On

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>