ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Problem redirecting old Wordpress urls with htaccess

September 26, 2013 3:48pm

Subscribe [1]
  • #1 / Sep 26, 2013 3:48pm

    Paul Vance

    123 posts

    I’ve ported an old Wordpress blog over to EE and I’m trying to redirect the old Wordpress urls to the new EE ones.

    The old urls look like this:

    http://mydomain.com/2010/05/url_title/

    In EE, I’d like them to look like this:

    http://mydomain.com/news/article/url_title/

    I’ve tried doing a ReidrectMatch 301 …. my htaccess file looks like this:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    </IfModule>
    
    
    RedirectMatch 301 ^/([0-9]+)/([0-9]+)/(.*)$ <a href="http://mydomain.com/index.php/news/article/$3">http://mydomain.com/index.php/news/article/$3</a>

    However the result is a url like this:

    http://mydomain.com/news/article/url_title/?/2010/05/url_title/

    As you can see it’s adding a bunch of unwanted segments. I think it has something to do with removing index.php for EE, but I’m not quite sure how to fix.

    Any ideas?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases