WordPress.org

Ready to get started?Download WordPress

Forums

Problem after moving blog to root leaving wp in subdirectory (2 posts)

  1. eberleds
    Member
    Posted 5 years ago #

    I hope someone can help me with this!

    After an initial install of wp into a subdirectory /blog, I decided I wanted my blog to be in the root, so I followed instructions from WP and everything worked. Then I discovered that links on other sites to the old blog url of 'example.com/blog' returned a 404 page not found.

    Here's where things started going wrong. I looked online and found instructions for rewriting the .htaccess file in the /blog subdirectory so that it would redirect traffic back to the root. After changing the .htaccess file in /blog I was still getting 404. Then I hit upon the idea that maybe the /blog/index.php file was causing a problem so I deleted it. This resulted in a directory/file listing page being displayed. I uploaded the index.php back into the /blog directory but then found out that all the formatting on the blog was gone, as if the CSS stylesheets were missing.

    I'm now afraid to do anything else that might cause more damage. Any ideas would be greatly apprectiated. BTW, the blog is harborlifeministries.org.

    Thanks!

  2. eberleds
    Member
    Posted 5 years ago #

    If this helps any, here's what the .htaccess file originally said in the public_html/blog directory:

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

    '# END WordPress'

    This generated a 404 error having the blog in the root. I modified .htaccess to the following:

    '<IfModule mod_rewrite.c>'
    'RewriteEngine On'
    'RewriteBase /'
    'RewriteRule ^blog/(.*)$ /$1 [R=301,NC,L]'
    '</IfModule>'

    Still got a 404 error. Tried variations, such as:

    '<IfModule mod_rewrite.c>'
    'RewriteEngine On'
    'RewriteBase /'
    'RewriteCond %{REQUEST_FILENAME} !-f'
    'RewriteCond %{REQUEST_FILENAME} !-d'
    'RewriteRule . /blog/(.*)$ /$1 [R=301,NC,L]'
    '</IfModule>'

    Thanks again for any insight.

Topic Closed

This topic has been closed to new replies.

About this Topic