Support » Fixing WordPress » Subdirectory install with access from root

  • Resolved C W (VYSO)


    I’m attempting to run WordPress from the root while keeping it in its own subdirectory. I’ve essentially followed the procedure under “Moving a root install to its own directory” in the Codex, the only difference being that my core files were already in the subdirectory, which makes Step 6 unnecessary.

    This has worked exactly as intended. Now, the /wordpress bit of the URL is stripped out and it looks to the end user as though they’re browsing instead of

    Problem: I don’t want all the old links to break. If an external site linked to, they’re now going to get a 404 page. I’d much prefer that they get automatically (301-)redirected to, which is the new location of the file.

    I’ve tried to insert a rule into the .htaccess files [N.B. the procedure in the Codex means that there are now two .htaccess files: one in the root and one in the subdirectory] to bring about this behaviour, but it is still failing to do the redirection (and is therefore delivering 404s). Here’s the .htaccess:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wordpress/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wordpress/index.php [L]
    RewriteBase /
    RewriteRule ^wordpress/(.*)$ /$1 [R=301,NC,L]
    # END WordPress

    The last two lines before the end of the if statement are my attempt to get the redirection to work.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Which .htaccess is this?

    Have you tried putting that “^wordpress/…” rule above the normal WordPress ones? .htaccess rules execute line by line. Order does (sometimes) matter.

    C W (VYSO)


    Yep, worked that out a couple of hours after posting! It’s now working fine.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Subdirectory install with access from root’ is closed to new replies.