Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

The site is run on wordpress (latest) and is installed in /htdocs/www/ This htaccess file is in /htdocs/www/roh/ along with a bunch of images & some css.

I want requests to the old html files to redirect to their new wordpress pages. I got most of it working, except the example below.

RewriteEngine On
RewriteBase /htdocs/www
ErrorDocument 404 /htdocs/www/
Redirect /roh/z1/q2lvl[1-9].html http://www.lunaz.com/realms-of-hyrule/legend-of-zelda/maps

I go to www.lunaz.com/roh/z1/q2lvl2.html, and it 404s and takes me to the main 404 page in my wordpress theme.

I tried ErrorDocument 404 /htdocs/www/roh/404.html, but that just got me an isp redirected spam search page. The only way I got the main wordpress 404 page working was by going up directories untill something worked. I do not want to send 404s to an http:// address.

My questions:

  1. Why doesn't the range of numbers [1-9] work?

  2. Why can't I get /htdocs/www/roh/404.html working for anything in /roh & below?

Sorry for the basic questions, Not exatly sure what to search for, so Google is only giving me examples I've tried or have working already.

share|improve this question

1 Answer 1

up vote 1 down vote accepted
  1. Use RedirectMatch directive instead. Redirect does strict string comparison while RedirectMatch uses regular expressions and therefore can be "dynamic".

    RedirectMatch 301 /roh/z1/q2lvl[1-9].html http://www.lunaz.com/realms-of-hyrule/legend-of-zelda/maps

    BTW, if you are using Redirect and/or RedirectMatch directives only, then no need for RewriteEngine on (those are from 2 different modules).

  2. Not sure -- but maybe because RewriteRules from folder above come into play... Rewrite debugging usually can shed some light on what is going on (it can show which 404 file Apache is trying to use, as rewrite rules got applied to it as well).. but for that you have to be able to edit server config or virtual host config.

share|improve this answer
    
Thanks much, that fixed it! :) If I can figure out the 404 page, will post back here. :) –  gpryatel Aug 11 '11 at 5:33

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.