Support » Fixing WordPress » Struggling with 301 redirect on some old pages

  • Hi there,

    I’ve recently installed WordPress and have moved our site across from Joomla. Finding it much easier to use than Joomla, and am loving all the plugins etc.

    My issue is when trying to set up permanent 301 redirects in .htaccess. The site used to be on coldfusion and when I set up redirects for any of these old pages that still show up in Google index, it works perfectly. For example:

    Redirect 301 /building_wraps.cfm

    The old page redirects perfectly to the new, nicely formatted WordPress URL.

    However, Google also has some of the Joomla URLs in its index, and when I try and redirect these using the same method, it doesn’t work i.e.

    Redirect 301 /index.php?option=com_content&view=article&id=26&Itemid=215

    What happens with these ones is they just redirect to the home page of the site, keeping the original query string, just minus the index.php part. So, the link above would go to the home page but display in the address bar as:

    I’ve looked up articles on 301 redirects and redirecting paramaters, but can’t quite get my head around it. I’m fairly sure that WordPress generated code at the top of .htaccess is what is causing this issue (i.e. stripping away the index.php prior to redirect or something like that) but I’m not sure how to go about changing it.

    This is the code generated by WordPress:

    # 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

    Any advice, suggestions or links to old answers to this same question will be greatly appreciated.

    Many thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Is the old platform installed in the same domain name as the WordPress site?

    It was….

    I didn’t know you could transfer from Joomla to WP, so I deleted the Joomla site first. The URLs I’m trying to redirect don’t actually exist anymore, they are just out there in Google land.

    I don’t think there is a way to do that because WordPress already has an index.php file, you are pretty much pointing to the same exact file.

    What you try to do is edit WordPress’s index.php file, and add the following conditions for redirection:

    Get this file, so it will get the exact URL (I didn’t test it):

    Add something like this:

    switch ( curPageName() ) {
        case 'http:// ':
            header( 'Location:' ) ;
        case 'second url':
            header('Location: another url');
        ... and so on.

    You can create a separated php file and include it in the index.php file.

    Thanks very much for the detailed feedback. I really do appreciate it.

    All seems a bit beyond my capabilities though I’m afraid. Almost choked on my coffee when I read it 🙂

    I’ll have another look later and decide if stressing my grey matter to this extent is worth the benefit of a few redirects. May just throw in the towel and wait for Google to index the new sitemap and let things switch naturally.

    Thanks again though. It’s brilliant to know that there is such great support to be found here, and that we’re not alone …

    You are welcome! Hope Google will index your site soon 🙂

    By my experience recently, it looks like it will take around 2 to 3 weeks. But it is important that you submit a site map to Google Webmaster Tools, if you haven’t done so:

    You can let a plugin to automatically generate a sitemap for you in WordPress

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Struggling with 301 redirect on some old pages’ is closed to new replies.