Mod_rewrite problem


#1

I’ve just moved my server over from another host and decided (foolishly it seems) to rename my MovableType directory from “mt” to “blog”. I want to do a mod_rewrite to redirect URLs from www.polaine.com/mt/some_article_or_other to www.polaine.com/blog/some_article_or_other.

I currently have this in my .htaccess file but it’s not working:

[code]#rewrites urls from mt to blog
RewriteEngine On

there is a plus sign before FollowSymlinks below, it’s got stripped out in the post

Options FollowSymlinks
RewriteRule ^/mt(.)*$ /blog$1 [R]
[/code]Also, I want to know whether img tags that are in the posts would be redirected with this or if there is a way to do it. They are all full URLS not relative.

Any ideas anyone?


#2

For what you’re doing, you could just use a redirect instead of incurring the overhead of mod_rewrite:

RedirectMatch /mt(.*) /blog$1 That will work on pages, images, anything with a path beginning with “/mt”.

If you want to use mod_rewrite anyway, remove the leading slash from your rule (yes, you use it for the redirect above, but not for mod_rewrite) and rearrange the parentheses:

RewriteRule ^mt(.*) /blog$1 [R]

If you want useful replies, ask smart questions.


#3

Thanks so much, that (both of them actually, though I used the redirect instead) worked like a charm and fixed up all the images too as you said.