Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

msjones

macrumors 6502
Original poster
Oct 18, 2007
429
4
Nottinghamshire, UK
Hello there,

I am no web coder, but have been asked to resolve an issue with a .htaccess file. I wondered if anyone here would be willing to help me?

I need to re-write the following link:

Code:
http://www.mydomain.com/blogs/untitled/2009/06/my-blog-title.html

to this:

Code:
http://www.mydomain.com/blogs/blog/my-blog-title/

More specifically I need a rule to re-write /untitled/2009/06/my-blog-title.html to /blog/my-blog-title/.

Any help or guidance would be much appreciated.

Thanks in advance
 

Lambros

macrumors regular
Feb 24, 2010
156
0
Sydney, Australia
Hello there,

I am no web coder, but have been asked to resolve an issue with a .htaccess file. I wondered if anyone here would be willing to help me?

I need to re-write the following link:

Code:
http://www.mydomain.com/blogs/untitled/2009/06/my-blog-title.html

to this:

Code:
http://www.mydomain.com/blogs/blog/my-blog-title/

More specifically I need a rule to re-write /untitled/2009/06/my-blog-title.html to /blog/my-blog-title/.

Any help or guidance would be much appreciated.

Thanks in advance

Here, try this:

Code:
//301 Redirect Entire Directory
RedirectMatch 301 http://www.mydomain.com/blogs/untitled/2009/06/my-blog-title.html(.*) 
http://www.mydomain.com/blogs/blog/my-blog-title//$1

Let me know if that helps.

In future, you can alter .htaccess files with this:

http://www.htaccessredirect.net/index.php
 

msjones

macrumors 6502
Original poster
Oct 18, 2007
429
4
Nottinghamshire, UK
Thanks for that man, really helped. I took it a little further with some regex matching.

Code:
RedirectMatch 301 /blogs/[0-9][0-9][0-9][0-9]/[0-9][0-9]/(.).html	http://www.mydomain.com/blogs/blog/$1/

Your help was much appreciated. As a python coder I never really get into any web stuff.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.