WordPress.org

Ready to get started?Download WordPress

Forums

Mixing Permalinks with regular Redirects (7 posts)

  1. air0day
    Member
    Posted 7 years ago #

    Hello,

    I have wordpress up and running, and I've got a nice little permalink structure that I have set up through the options. The htaccess file was edited correctly and the permalinks all work.

    My problem is that I want to add some additional redirects so that old pages redirect to newer blog posts. I'm not looking to do a rewrite rule or anything, just a simple RedirectPermanent directive. Any time I add the redirect to the htaccess though, I wind up getting Error 500. I think there is some kind of conflict with the wordpress modifications to the htaccess file.

    Does anyone have an example of an htaccess file where Redirects and the wordpress rewrite rules live in harmony?

    WordPress is installed to the root of my html folder, which might be complicating things.

    Thanks.

  2. Christopher J. Hradil
    Member
    Posted 7 years ago #

    the root folder is no problem, you may want to check the apache site for the correct .htaccess syntax. it sounds like it is a simple error such as that your redirect rules are in the wrong place, etc.

  3. kallywag
    Member
    Posted 7 years ago #

    air0day, I have the same issue. I tried several different syntaxes to set up an individual redirect, but I'm getting the 500 error. I tried these that I found in tutorials:

    • Redirect permanent /oldpage/ /newpage/
    • redirectpermanent /oldpage/ /newpage/

    I'm going to try to read up on apache directives to figure this out, will post back if I do.

  4. air0day
    Member
    Posted 7 years ago #

    Chradil,

    I don't think the problem is my htaccess format. Here is my file:

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

    Redirect /one.html /two.html

    ---

    If the redirect isn't there, everything works (except obviously one.html doesn't redirect anywhere) but adding that line results in Error 500 when I try to access the site at all.

  5. air0day
    Member
    Posted 7 years ago #

    Kallywag,

    So I've discovered that you and I are both idiots. For a redirect, the second thing apparently needs to be a full URL.

    Like:

    Redirect permanent /one.html http://site.com/two.html

  6. kallywag
    Member
    Posted 7 years ago #

    Yep found that out as well, but I opted for RewriteRule in the end so I could make use of conditionals.

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Also, you should put your redirects at the top of the .htaccess file, before all the WordPress rules. This speeds processing.

    You can do the same with Rewrites as well. Just be certain that when you do a redirect via a rewrite, that your rule has an [R,L] or [R=301,L] or whatever. The L being the important bit.

Topic Closed

This topic has been closed to new replies.

About this Topic