Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My ht access includes:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/preview/(.*)\-[0-9]+$
RewriteRule ^/preview/(.*)\-[0-9]+$ /$1 [R=301,L]

but still when I try to access something such as:

http://sg.wyli.co.uk/preview/coronation-street-the-mystery-of-the-missing-hotpot-recipe-1806

it doesn't redirect (where http://sg.wyli.co.uk/coronation-street-the-mystery-of-the-missing-hotpot-recipe will work...)

im using a plugin: Wp htaccess Control to add the rule, so it's definitely being added to the wordpress rewrite rule system, but it's not having any effect?

are there any more wordpress quirks I need to avoid? Is there a basic error I'm missing?

share|improve this question
    
Try it witout starting / in your rules and a line RewriteBase / after RewriteEngine on. And why the condition? –  Raphael Jan 20 '12 at 17:31
add comment

1 Answer

up vote 0 down vote accepted

Sooo the problem was my brackets around the content in the condition I think.

I'm still not so hot on these things, but I use these rules and they work:

RewriteCond %{REQUEST_URI} ^/(review|preview|feature).*\-[0-9]+$
RewriteRule ^review/(.*)\-[0-9]+$ /$1 [R=301,L]
RewriteRule ^preview/(.*)\-[0-9]+$ /$1 [R=301,L]
RewriteRule ^feature/(.*)\-[0-9]+$ /$1 [R=301,L]

note: the (review|preview|feature) but is an x OR y OR z, as I have the rule working for any of those folders specifically.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.