Support » Fixing WordPress » Complex redirect – help!

  • Resolved zarkobiz


    I need to redirect the incoming traffic seeking old permalinks to and I don’t know how to do it.


    1. Initial WP installation in
    Initial permalinks /blog/?p=123. This ran for several months

    2. Changed permalinks to /%post_id%/%postname%
    everything worked fine and ran at this config for several months
    Dean’s permalinks migration or Smart 404 did an excellent job with no 404s for end users.

    3. Changed the apparent location of the blog to root (Site address URL in general settings). This is how I want to run, but my oldest links from twitter and web sites that look like just return the missing.html page in the root. Some of them that I’ve created after step 2 were done with just the ID number and without the ?p= and they were still working fine, but now even they are out, so if there’s a way to dynamically eliminate the ?p= in the rewrite process, that might be the solution, but I’m too much of a WP newbie and don’t know how to do it.

    working old permalink example:
    non-working old permalink example:

    Now, I was able to make the latter work by putting a separate .htaccess in /blog/:
    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /blog/
    RewriteRule ^(.*)$$1 [L,R=301]
    # END WordPress

    HOWEVER, this disables my /blog/wp-admin (admin login), so I have to remove that .htaccess each time I want to administer the blog, and I’ve seen some inconsistent results with site losing formatting.

    I need to write either a dynamic redirect for the /blog/?p=123 permalinks or a redirect statement for every single one of them (and I don’t really have a problem with that, as long as I’m able to make them work.) I have been reading various tutorials and forum posts for days and I didn’t make any progress.

    This is the current .htaccess file in the root:

    # 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]
    # END WordPress

    I’m lost and I need a few lines of code from a redirect/rewrite wiz.
    Please help. Thank you in advance.

Viewing 1 replies (of 1 total)
  • Resolved by downloading “Redirection” plugin, then setting up the following redirection rule in it:

    Source URL: /blog/(.*)
    Target URL: /$1

    with Regular Expression (regex) box checked

    For some reason the old default site address didn’t work after this so I have another rule for
    Source URL: /blog
    Target URL: /
    (regular expression box not checked)

Viewing 1 replies (of 1 total)
  • The topic ‘Complex redirect – help!’ is closed to new replies.