Forum Topic: mod_rewrite not resolving?

Forum: .htaccess Forum : Redirecting • Posted by Greg Miller • Updated:

Hi Jeff,

I first want to say, this is an awesome book and resource. Now I’m stuck and I feel like I’m following the info, so please straighten me out. I’m sure I must have something not quite right.

The customer had an old website that was redesigned with a whole new navigation structure. The plan is to use mod_rewrite to point the old nav pages to the new nav pages. This is a WordPress site and already has a call for the RewriteEngine On.

<IfModule mod_rewrite.c>
  RewriteCond %{REQUEST_URI} ^/executive-briefing/ [NC]
  RewriteRule .* [R=301,L]

Above is the code in the .htaccess file. Using a browser, I test but I’m still seeing the 404 page. I’ve got several of these written for all the navigation. Thanks in advance for your help!

2 Replies to “mod_rewrite not resolving?”

Posted by Jeff Starr

Hi Greg,

There are a couple of things to check:

1) First try moving the location of the mod_rewrite rule to either before or after any other mod_rewrite rules, such as WP permalink rules (if in play).

2) If mod_rewrite still isn’t doing it, try using mod_alias, for example:

RedirectMatch 301 ^/executive-briefing/

You can learn more about mod_alias in chapter 6.1 in the book.

Posted by Greg Miller •

Hurray! Jeff’s RedirectMatch call was perfect. Thanks!