Forum Topic: mod_rewrite not resolving?
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 .* http://www.customerwebsite.com/sales-planning-knowledge-center/sales-management-webinars/ [R=301,L]
</IfModule>
Above is the code in the .htaccess file. Using a browser, I test http://www.customerwebsite.com/executive-briefing/ 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?”
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/ http://www.customerwebsite.com/sales-planning-knowledge-center/sales-management-webinars/
You can learn more about mod_alias in chapter 6.1 in the book.
Hurray! Jeff’s RedirectMatch call was perfect. Thanks!