views:

9

answers:

1

Hi There,

I want to redirect users from a URL formatted like this:

http://blog.mysite.com/any/number/of/directories/<POSTNAME>.html

TO:

http://mysite.com/about/blog/entry/<POSTNAME>/

Where is the same hyphen-separated string, and, the original URL can have any number of directories before the filename (none of which are 'passed' to the new URL).

Is it possible to create a htaccess rule which reaads this pattern?

Many thanks for your help! :)

A: 

I think you're looking for something like this:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^blog
RewriteRule ([^/]+)\.html$ http://example.com/about/blog/entry/$1/ [R=301,L]
Tim Stone
Perfect, Thank you!
Freddy
Good stuff, glad to hear it's working.
Tim Stone