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

Similar Threads
thread Thread Starter Forum Replies Last Post
Resolved: htaccess cannot get to work! OS X Lion crittle1 Mac OS X Server, Xserve, and Networking 3 Feb 9, 2014 12:11 AM
Enabling .htaccess for localhost octane OS X 10.8 Mountain Lion 3 Jan 24, 2013 09:04 AM
questions about htaccess olup Web Design and Development 2 Oct 6, 2012 07:02 AM

Forum Jump

All times are GMT -5. The time now is 04:08 PM.

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

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