WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WordPress and Site in Separate Folders (3 posts)

  1. rcb75
    Member
    Posted 1 year ago #

    I know this question has been asked a thousand times, and I feel like I've read and tried every one of the responses. I must be overlooking the one certain way to accomplish what seems like should be a simple task.

    I originally had installed WordPress in the root of my site prior to beginning real development. Then I read some more and decided it would be smart to locate the WordPress core files in a subdirectory of the root, which I named wp. I uninstalled and reinstalled using the subdirectory and then developed my site, having read that it is possible to do this and still have users access the site's root without the subfolder being visible to them in the url.

    What I thought should work was this:

    1. In WordPress under Settings | General, specify the URL addresses I want to use.
    WordPress (where WordPress is installed): http://www.mysite.org/wp
    Site: http://www.mysite.org

    2. Copy the index.php file to the root folder and edit it so that it reads:
    */require('./wp/wp-blog-header.php');

    3. The htaccess file in the root has this content (nothing more or less):

    # 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
    #

    I did not do anything with Permalinks since I'm not using them and they are still set as Default.

    Can someone please tell me what I'm doing wrong?

    As s short-term solution I have set both URL addresses in WordPress to be http://www.mysite.org/wp, no index.php in the root (lives in my wp folder only), and code in my htaccess in the root that redirects to the wp folder:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(www.)?forestmoontheater.org$
    RewriteRule ^(/)?$ wp [L]

    While this works, I'd rather the wp folder not appear in the url so when users are on my site. Right now it shows as http://www.mysite.org/wp/....

  2. rcb75
    Member
    Posted 1 year ago #

    Correction:

    My htaccess file in #3 above was edited to look like this instead:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wp/index.php [L]
    </IfModule>
    #END WordPress

  3. rcb75
    Member
    Posted 1 year ago #

    I started fresh today and followed the instructions here precisely. This time it worked. I think my mistake was in modifying the htaccess file after copying it to the root, which was something I had read elsewhere but was not specified here. Just stick with the steps exactly as written.

Topic Closed

This topic has been closed to new replies.

About this Topic