Forum Moderators: phranque

Message Too Old, No Replies

Removing hyphens from URL

except domain name!

         

Landyman

11:55 pm on Jun 1, 2004 (gmt 0)

10+ Year Member



Hello,
Currently, I have a site that uses too many hyphens in many of the URL's. Basically, I just want to remove all of the hyphens from the URL except the domain name and redirect the old URL's to the new ones.
The directories and page names can range from 2-5 words each, and currently, all words are seperated with hyphens. Some pages are also 2-4 directories deep in the URL. I tried writing a "RedirectMatch 301" for this, but was only successful in redirecting the first directory name, and had no success when going deeper in the URL.
Since there is a wide range of words and/or directories in the current URL, I am not sure on how to write the script for this since I'm not an expert on this stuff.
Does anyone know how to automate this into a nice script?
Thanks in advance!

jdMorgan

2:00 am on Jun 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Landyman,

You may find this post [webmasterworld.com] to be of some help. It discusses replacing underscores with hyphens. In your case, you will want to replace hyphens with nothing, but the principle is exactly the same.

Jim

Landyman

4:36 pm on Jun 2, 2004 (gmt 0)

10+ Year Member



Thanks Jim.
I had looked at that post before, wondering about if there were more than 7 dashes. I just didn't read it closely enough =].
Thanks for the help
-Landyman