• Resolved markhoweiwen

    (@markhoweiwen)


    Hi

    Seeking some advice. So I have been learning wordpress and I completed a online course on how to create a website and I want to keep that main site and create a new site working on a new project.

    I followed how to set up a multisite by changing the wp-config.php file and the .htaccess file. I re-logged in and great! I got the My site menu toggle. So I created a new sub site. Calling it Newsite (http://localhost/wp/newsite).

    I tried to enter the dashboard and I get the following:

    “Access forbidden!
    You don’t have permission to access the requested directory. There is either no index document or the directory is read-protected.
    Error 403
    localhost
    Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.6.19″

    How do iget my new sub site working? What did I do wrong?
    I tried to following a post https://ww.wp.xz.cn/support/topic/how-do-i-create-another-wordpress-site-on-localhost?replies=7
    but it tells me how to create a entirely new site which I did succeed there but I wanted access to my new sub site(newsite) and use the dashboard to create a new sub website.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Sounds like your .htaccess file is not enabled. The easy way to check is add a garbage line in .htaccess file then access your site – if your .htaccess file is enabled you will get a 500 error. If you do not get a 500 error that means you need to enable htaccess via AllowOverride directive

    Thread Starter markhoweiwen

    (@markhoweiwen)

    Hi many thanks for helping me out.

    so I tried to do as you suggested. I opened up the .htaccess file and placed a garbage line like Rewrite Something and saved it.

    I went back to my localhost file and couldn’t get in. I got a 500 error. Which means my .htaccess file is enabled. I took out the garbage line and I could access my localhost again and open up my first website I made.

    By the way just to add, I can access my website (http://localhost/wp/newsite/) however its not properly laid out. All the sample text is stuck of the left screen such as the “hello world text and all the comments”

    Its the dashboard that give me the Error 403

    Thread Starter markhoweiwen

    (@markhoweiwen)

    Finally found something !!

    https://ww.wp.xz.cn/support/topic/adding-site-in-subdirectory-access-forbidden-403-when-going-to-wp-admin?replies=12

    I used the code from this link and got it working

    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]

    I don’t know what the above did but it solved my Error 403 problem

    How did you initially setup your .htaccess? FYI, you should not be copying information from other sources, it could be out-dated or wrong. The .htaccess and wp-config.php information should be provided by your installation in Network settings – http://localhost/wp-admin/network/setup.php

    Thread Starter markhoweiwen

    (@markhoweiwen)

    Hi,

    When I set up my .htaccess, I started with
    1. Tools tab
    2. Setup network
    3. Copied from WordPress (the info they ask you to input)
    define(‘WP_DEBUG’, false);
    define(‘WP_ALLOW_MULTISITE’, true);
    define(‘MULTISITE’, true);
    define(‘SUBDOMAIN_INSTALL’, false);
    define(‘DOMAIN_CURRENT_SITE’, ‘localhost’);
    define(‘PATH_CURRENT_SITE’, ‘/wp/’);
    define(‘SITE_ID_CURRENT_SITE’, 1);
    define(‘BLOG_ID_CURRENT_SITE’, 1);

    into the wp-config.php
    4. went into htaccess and pasted
    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

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

    From there I got the tab that says create new site. So I created it and I got the problem above. Spent the whole day looking for solutions and I cam across that and plug that in and it works.

    Your .htaccess rules above match my systems. I copied my .htaccess below. If those .htaccess rules are not working for you, you should try figuring out why. I think the reason why is that you have WP installed in a separate installation directory – https://codex.ww.wp.xz.cn/Giving_WordPress_Its_Own_Directory

    Note most people install WP at the root – http://domain.com
    But you can install WP in a directory – http://domain.com/wp
    Or you can install WP in a directory but still run out of root


    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

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

    Thread Starter markhoweiwen

    (@markhoweiwen)

    Hi

    Thanks for helping so I have a question from what you are telling. Does that mean when people install on to a server/host the system .htaccess file the above is correct. But because I am installing as an offline WordPress to work locally. The above won’t work?
    Hence why I had to insert a different line due to this?

    However once I go online to my host I should make sure I change it back?

    My htaccess file is for WP running out of root (WP happens to be installed at root too).

    Your WP installation seems to be running (and installed) out of /wp – http://localhost/wp/newsite

    If you do run out of a directory, the WP setup requires additional steps – http://codex.ww.wp.xz.cn/Moving_WordPress

    I do not know how you installed WP into your subdirectory /wp, but you probably missed something which is causing your problem

    Thread Starter markhoweiwen

    (@markhoweiwen)

    Well I actually was looking online and I came across this link
    https://premium.wpmudev.org/blog/setting-up-xampp/

    Basically they taught you step by step what you had to do to install wordpress locally. I followed all their instructions and then came across the problem of entering the dashboard.

    I installed xampp so its in the C:/ then as per the instructions in the link you download wordpress and place it in the htdocs folder. So you are correct that I am running out of a sub directory.

    I think the issue came about was because the information given is for people who have a domain/web host. I think it needed to be configured to accept a localhost.

    Thread Starter markhoweiwen

    (@markhoweiwen)

    This is resolved

    markhoweiwen –
    It looks like I’m a few months behind you. I too used the instructions in wpmudev and am running into the same problems with my second site. Following the steps you took to resolve your problems, I still end up with “Access forbidden…Error 403”. Would you be willing to help me figure this out for my local sites?
    Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Newbie Multisite on localhost XAMPP’ is closed to new replies.