WordPress.org

Ready to get started?Download WordPress

Forums

Adding site in subdirectory, Access Forbidden 403 when going to wp-admin (12 posts)

  1. paravorheim
    Member
    Posted 1 year ago #

    I have been having this problem all week. I've gone through a lot of forum posts with similar issues, but none of the fixes have worked for me. This is a local site, with subdirectory setup instead of subdomain. My .htaccess file is as follows:

    RewriteEngine On
    RewriteBase /singlesite/
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1/wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) C:\xampp\htdocs\singlesite/$2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ C:\xampp\htdocs\singlesite/$2 [L]
    RewriteRule . index.php [L]

    and my DocumentRoot is as follow:

    <Directory />
    	Options FollowSymLinks
        AllowOverride All
    	Order deny,allow
    	Allow from all
    
    </Directory>

    The original landing page, http://localhost/singlesite, works fine. Adding a new site, say http://localhost/test, results in a new site without a theme (just text and links), and the dashboard, or wp-admin, leads to a Access Forbidden 403 page.

    I figured out that in the Apache error logs there was a "client denied by server configuration" with the following path:
    C:/xampp/htdocs/singlesite/test

    I realized that this path actually does not exist, so as a workaround I copied all files in the singlesite folder into the singlesite/test folder. This allows me to access the sites in full with themes and dashboard.

    Any help would be appreciated, all the experts here have done a great job.

  2. Try this:

    <Directory />
    	Options FollowSymLinks
        AllowOverride Options All
    	Order deny,allow
    	Allow from all
    
    </Directory>
  3. paravorheim
    Member
    Posted 1 year ago #

    I tried replacing mine with yours, and I still get a 403 forbidden. when accessing dashboards of subdirectory sites, and a plain text and link page for the sub sites. do you need any other error logs, or files?

  4. paravorheim
    Member
    Posted 1 year ago #

    I just realized I may have added the <Directory /> in the wrong place... it does go in apache's httpd.conf right?

  5. Yes. Is this localhost running xamp?

  6. paravorheim
    Member
    Posted 1 year ago #

    Yes, it is. I should have mentioned that, sorry.

  7. paravorheim
    Member
    Posted 1 year ago #

    Is there an unwritten rule (or written) that says not to use XAMPP? I have tried this using the bitnami installation as well, and received the same errors.

  8. tantawi
    Member
    Posted 1 year ago #

    I have exactly the same problem, any help?

  9. Brad Williams
    Member
    Posted 1 year ago #

    I just ran into this same issue running WAMP locally. The issue was with the htaccess rules provided by WordPress. WordPress told me to use this:

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) C:/wamp/www/brad-site/$2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ C:/wamp/www/brad-site/$2 [L]
    RewriteRule . index.php [L]

    When it should have been:

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

    Updating these 6 lines in htaccess fixed the issue for me.

    I was able to get the proper htaccess rules from a different local Multisite network I have setup that was working fine. Hopefully this helps others.

  10. sjaved
    Member
    Posted 1 year ago #

    Thanks Williams. I was struggling to solve this issue and pulling my hairs and was going to throw the laptop out.

    wordpress must fixed this issue.

  11. sudesh1992
    Member
    Posted 1 year ago #

    Thanks a lot Williams! I am using WAMP and this new 6 line of code worked like a charm! Really appreciate it!

  12. tarlsieWP
    Member
    Posted 9 months ago #

    Thanks Brad,
    this solved my problem
    Daniel

Topic Closed

This topic has been closed to new replies.

About this Topic