.htaccess underscores
September 24, 2004 12:15 PM
Subscribe
.htaccess question. I want to turn all the underscores in a url into dashes. More inside..
I'm starting to use the new dynamic page option MT 3.1 offers, and using the change as an opportunity to redesign and 'clean house'. I've read about how using underscores for dirification doesn't work as well with search engines as using dashes. I've got my pages in my fresh build using dashes, but I want to redirect all of the inbound links, search engine requests, etc. to the new version.
But I don't know how. Currently, my archive structure looks like this:
/tester/archives/2004/09/10/mt_31_installation
But, I want it to look like this:
/tester/archives/2004/09/10/mt-31-installation
Any ideas about the code involved? The structure is pretty rigid:
/YYYY/MM/DD/dirified-title-with-multiple-words
posted by jmevius to computers & internet (6 comments total)
RewriteEngine On
RewriteRule ^([^_]*)_(.*)$ $1-$2 [R=301,L]
posted by Civil_Disobedient at 1:33 PM on September 24, 2004