.htaccess 301 redirect and wordpress

Discussion in 'Webmaster Discussion' started by php.allstar, May 30, 2011.

  1. php.allstar

    php.allstar New Member

    Hi,

    I regularly post replies to people on here looking for help woth various php issues.

    Now however, I would like some help myself!

    I have updated my website dogzone.ie to use classipress which is a classifieds ads theme for wordpress.

    Now I would like to point all the old links to their new locations with the help of 301 redirect rules in a .htaccess file.

    Can anyone help me with this? I've thrown everything but the kitchen sink at this problem at this stage.

    For example, I would like to redirect this:
    http://www.dogzone.ie/pups-for-sale/french-bulldog
    to this:
    http://www.dogzone.ie/sections/french-bulldog-dogs-for-sale-in-ireland/
    My .htaccess file looks like this:

    Code:
    # 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]
    </IfModule>
    
    # END WordPress
    I would be very grateful if you could sort this one out for me.
     
  2. davkell

    davkell New Member

    Not exactly answering your question, but I was looking at this Redirect plugin today (I'm going to have to do something similar on a site in the next couple of days). It looks handy - it avoids having to write .htaccess rules for all pages.
     
  3. mneylon

    mneylon Administrator Staff Member

  4. php.allstar

    php.allstar New Member

    Hi,

    I've used .htaccess rewrites on practically all of the sites I've worked on, well versed in regular expressions etc. Yet for some reason, no matter what rules I put in, I could not get it to work. I'm sure my regular expressions were bang on...

    I put it all down to the default wordpress rewrite rules causing the confusion in me...maybe they were somehow overwriting my rules?

    Maybe its the fact that I went with the dreaded /%category%/%postname%/ permalink structure (I just wanted ultra clean urls - performance is not a big issue on this site)

    Nonetheless, I've tried the plugin you both recommended and it's great. Working like a charm. Supports regular expressions too which is a huge plus.

    While I would still love to know why I couldn't get the rewrite rules in the .htaccess to work, you can consider my problem solved! Thanks
     

Share This Page