WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] different permalinks structures (9 posts)

  1. robertbouma
    Member
    Posted 6 years ago #

    Hi,

    Is it possible to have two different permalink structures in WordPress?

    Because of an earlier installation there still some hits from visitors and searchengines on (for example):

    http://domain.com/archive/2005/11/15/post-title

    while the new structure is:

    http://domain.com/2005/11/15/post-title

    It's a shame to serve the visitors on the first url a 404 while the content still exists on the second url.

    It would be really nice if one of you guys could help me with this. The easiest would be if it could be solved in my WordPress installation itself, but adding some lines to my .htaccess file would also be fine.

  2. moshu
    Member
    Posted 6 years ago #

    No, you cannot have two different permalink structures on the same installation.
    However, a htaccess guru might be able to solve your problem with a permanent (301) redirect rule in your htaccess file.
    Maybe just googling for some tutorials on htaccess and rewrite rules you can also come up with the solution.

  3. robertbouma
    Member
    Posted 6 years ago #

    Hmm, to bad... But thanks for the answer! I will fire up Google and start searching. :)

  4. lingmiester
    Member
    Posted 6 years ago #

    Should it not be automatically redirected in the newer editions of wordpress?

  5. robertbouma
    Member
    Posted 6 years ago #

    How do you mean? The second permalink structure does an automated redirection because that's how I filled in the permalink option in WordPress itself.

    The first structure is how I did it in an earlier version (a couple of serverhosts ago.. ;) ) and in my stats I see that I still get hits on those links. Those generate a 404 however and that's a pity.

    .htaccess looks promising though. Now to find the correct RewriteRule line. :)

  6. moshu
    Member
    Posted 6 years ago #

    I don't think the statement about WP "automatically redirecting" from one permalink structure to another, is true. Sorry. That just doesn't make sense...

  7. robertbouma
    Member
    Posted 6 years ago #

    Hmm, perhaps I wasn't realy clear, sorry about that. What I meant was that a while ago (a year or something) I hosted my WP installation on a server that did support permalinks (and the use of .htaccess files by the user). I then moved to a hosting provider that didn't and just a couple of weeks ago I got my own VPS server and now I can use permalinks again.

    The only thing was, I choose a different structure (yes, stupid, I know.. ;) ) What I meant by 'automated redirecting' was the use of permalinks as such. Not switching between the old structure I used and the new structure.

    I guess that 'automared redirecting' is not a very good term because technically spoken there is no redirecting but I just coudln't find a better way to describe it.

  8. moshu
    Member
    Posted 6 years ago #

    Sorry, I was answering to lingmiester who posted a completely incorrect statement about newer WP versions.

    @robert: I understand your request and as I said earlier it can be done with .htaccess... I just don't know the code, sorry.

  9. robertbouma
    Member
    Posted 6 years ago #

    Well, it took me some digging, but I found the solution!

    You can add the following lines to you .htaccess, just beneath the RewriteBase / line:

    RewriteCond %{REQUEST_URI} ^/archive [NC]
    RewriteRule ^archive/(.*)$ $1 [L,R=301]

    That did the trick. Seems so simple once you have te solution... ;)

Topic Closed

This topic has been closed to new replies.

About this Topic