Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 1, 2012, 10:06 AM   #1
msjones
macrumors 6502
 
Join Date: Oct 2007
Location: Nottinghamshire, UK
Can anyone help with .htaccess?

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
__________________
MacBook Pro / Nexus 4.
InfoSec guy.
msjones is offline   0 Reply With Quote
Old Nov 1, 2012, 06:34 PM   #2
Lambros
macrumors regular
 
Join Date: Feb 2010
Location: Sydney, Australia
Quote:
Originally Posted by msjones View Post
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
Lambros is offline   0 Reply With Quote
Old Nov 2, 2012, 02:01 AM   #3
msjones
Thread Starter
macrumors 6502
 
Join Date: Oct 2007
Location: 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.
__________________
MacBook Pro / Nexus 4.
InfoSec guy.
msjones is offline   0 Reply With Quote
Old Jul 11, 2013, 05:58 PM   #4
cssbutton
macrumors newbie
 
Join Date: Jul 2013
Quote:
Originally Posted by msjones View Post
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.
Using this site http://www.htaccessredirect301.com , you can do this easily
cssbutton is offline   0 Reply With Quote

Reply
MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 10:11 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC