Web Hosting Talk







View Full Version : mod_rewrite help needed - how to substitute a URL?


mrzippy
08-01-2008, 02:22 PM
Hello,

I have a customer who has a wordpress blog with a URL like this:

http://www.domain.com/blog/post123.html

She wants to change the URL to this:

http://www.domain.com/post123.html

It is no problem to relocate the wordpress software, but I'm unsure how to handle existing incoming links. I'd like to use mod_rewrite to do this, but everything I've tried produces an error 500.

Does anyone know how to do the mod_rewrite for this?

foobic
08-01-2008, 11:30 PM
Assuming you're removing the old directory altogether, something like this should handle the old links:
RewriteEngine On
RewriteRule blog/(.*) /$1 [R=301,L]
If you still get 500 errors check the log - perhaps you have some general issue with mod_rewrite?