Hey all
I have a simple CMS system that uses page paths to serve the correct data from a database. The problem now is that it is going to be multilingual and so I have had to rework the database tables to use the record ID rather than a simple path.
So my question is, how can I rewrite the url to maintain the integrity of my url’s but still pass an ID as well.
WHY is that first / optional? If the entire language part is optional, enclose the / in the atom and make the whole thing optional! WHY would you even consider allowing a trailing /?
THEN, [a-z] … will you be matching zz (or zzzzzzzzzz) for a language? Naw, I didn’t think so. As you add languages, you need to LIST the language options you will support in that first atom, i.e., ^((en|de|fr|es)/)? … to OPTIONALLY specify English, German, French or Spanish - with the language pair and / inside the optional atom’s definition.
([a-zA-Z0-9_\/]+)/? is okay except that the / need not be escaped by the blue \. For my “Wilderness-Wally” client, I’ve also allowed him to use [-a-zA-Z0-9_&'!] adding the hyphen, ampersand, single quote and exclamation to his titles (just because I’m a nice guy :jester2: ).
I’ve lost the rest of your question in the quoted parts but you should get the idea from the above. Teaching your CMS to embed the language and use it to specify the language for the specified title will be the difficult part (but I’m guessing you’ve already figured that part out!).
Oh, as Dan said, if you’re changing id numbers of the post, you’re going about it all wrong! First, you don’t use id numbers here (they’re not derivable from your title - or whatever field you’re searching) and second, you don’t need id’s - just check http://wilderness-wally.com’s pages if you don’t believe me (the stories are ALL requested by the (unique) title field in the record).