Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION Migrating old slugs with underscores and caps

If there is a thread addressing this already, please feel free to let me know. I walked through the latest few pages, and also searched for "underscore" and "underscores," but didn't find a thing that seemed to help.

I am migrating a site over to GS.

In its first incarnation, it was flat HTML for years. So, all consisting of filenames of the sort *.html

It's been in Wordpress for about ten years now, and still has the exact same slugnames (I use a WP plug-in to custom-slug pages).

The slugnames contain upper and lowercase, and underscores. So, for example: Shorts_Moon.html

I was able to monkey with my .htaccess file to get it to use ".html" which was right there in the documentation (thank you!), but if I try to enter a custom slug such as "Shorts_Moon", it pops the page out of the menu and changes the underscore to a dash and lower-cases all the letters.

I would appreciate advice on how to match up with the same URL structure.

Thank you kindly!
post your rewrite rule
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Oh gosh, of course -- I should have done that in the base post. I apologize.

It is:

RewriteRule /?([A-Za-z0-9_-]+).html$ index.php?id=$1 [QSA,L]
you might be able to handle the slug rules in your rewrite. hmm
if not a hook or plugin would have to translate or clean the slugs
or use a custom fields to add the slug and use a route parser to map them.

Some clever regex might do it, if its supported by your apache, or you could redirect to a php script that does it for you then redirect again...

RewriteMap tolower int:tolower
RewriteRule ^([^/]+)/?$ somedir/${tolower:$1}

I cant say i know exactly how
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
The cheater way that I thought of would be to drop a list of server-side redirects, so "Projects_Banana.html" simply gets redirected to "projects-banana.html" but after 15 years, a person gets used to their URLs, y'know. Wink

Besides, that would only be one-way.

It was my hope that -- because underscores (and case differences) ARE valid URL characters -- that maybe I had just screwed up a configuration setting somewhere.
If there are only a dozen, yeah hardcode the redirects for each one to the slug.
If there are hundreds, redirect all to a processor and have it map them doing a standard gs slug clean cl()

Either way this is gonna impact your site speed if you are not using permanent redirects.
Really the only reason to do this is SEO juice, so it might be worth it.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
There are, hm, about 60 or so links. It's not a killer, creating new slugs would just be a mild annoyance that would take me a day or so.

I could offer server-side redirects and float the idea "Well, maybe it's time to think about just simplifying the URL scheme," letting my client tell me either "Sure, okay," or "This may not be the right tool," and running with that...

I am marginally concerned about the notion of converting approximately 1000 or so WP blog entries into a format acceptable to GS. I've seen some importing schemes, but before I explore THOSE (which would take more time), I wanted to know if this URL issue was a thing I could fix (which would take much less time).
Oh if its a client then nevermind keep it the same or you will catch hell
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Oh, I wouldn't change it without making absolutely sure it was okay. What I meant by "float" was to offer the notion.

He's not an unreasonable guy -- if I convinced him that this was the best solution, he would be open to that idea (he's already expressed an openness of mind about a restructure of the site, and he's also intrigued at the notion of doing this with a flat-file CMS, so he's not a set-in-concrete kinda guy).

But obviously, I feel strongly about doing my due diligence and seeing if there IS a way to preserve that nomenclature. Smile

I kinda wish I had a deeper technical knowledge on this stuff, but I only go so deep. Er... "derp." Smile

Thanks for offering insight, shawn_a.

Users browsing this thread: 1 Guest(s)