.htaccess redirect from static site to Wordpress

I'm trying to redirect pages from an old static site to new pages in WordPress. So, for example,


should redirect to:


I'm using the following in the .htaccess file, but it's not working:

redirect 301 /mysite/contact.htm http://www.mysite.com/contact

Who is Participating?
carrboroConnect With a Mentor Author Commented:
I ended up figuring this out myself and implemented as a series of rewrites along the lines of:

RewriteCond %{HTTP_HOST} ^jeffthomascobb.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.jeffthomascobb.com$
RewriteRule ^contact\.htm$ "http\:\/\/www\.jeffthomascobb\.com\/contact\/" [R=301,L]


Works fine now
Steve BinkCommented:
When you say "not working", what gives you that impression?  I mean, aside from not seeing the new page.  Are you receiving any error messages?  Have you examined the request/response conversation?
I would do it with Apache's URL Rewriting engine.

- be sure to have the rewrite_module enabled (via : a2enmod rewrite)
- in your site configuration (or local .htaccess), add something like :
        RewriteEngine On
        RewriteRule ^http://www.mysite.com/contact.htm http://www.mysite.com/contact

I hope this helps

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

carrboroAuthor Commented:
By not working I mean the old URLs are still resolving to the old, static HTML pages rather than the new WordPress pages.

I tried the rewrite above, but that is not working either. Here is what my current .htaccess file looks like. Note that I have WordPress in its own /blog directory and am using a page, rather than the blog, as my home page.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress
RewriteCond %{HTTP_HOST} ^hedgehog-fox.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.hedgehog-fox.com$
RewriteRule ^.*$ "http\:\/\/www\.jeffthomascobb\.com\/blog" [R=301,L]
No need to add RewretiEngine on as it's already done

Have you done several tests with my RewriteRule thing ? I think the I remember the sequence is important - you should check on apache2 official web site : http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

=> did you try it right after the "RewriteEngine On" line ?
Your 301 RewriteRule doesn't look right to me. I think it should be

RewriteRule ^(.*)$ http://www.jeffthomascobb.com/blog/$1 [R=301,L]

Also, I think you want an [NC] at the end of your last RewriteCond so that the rule takes effect regardless of the case in the browser address bar. Otherwise, only www.hedgehog-fox.com will be redirected. www.Hedgehog-Fox.com, etc. won't.
carrboroAuthor Commented:
None of the above is working. I really don't want to change the Rewrite rule as souseran suggests, as that Rewrite has been working fine. It was in place before the changes that led to this question.

I have tried the putting the Rewrite after Rewrite on, and that makes no difference. I have also checked to order.

I am not actually clear why Rewrite would be the correct approach in the first place, given that what I am trying to redirect is static HTML pages, whereas Rewrite - at least as I understand it - tends to apply when the pages to be redirected are dynamic. Regardless, it seems to me this should not be terribly complicated. Someone must know the right approach to this.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.