I suggest to use transliteration module to make subdomain urls canonical. My kung-fu is too poor to create patch, so I just show my changes, and may be somebody more smart will create patch and submit it.
I have changed function clean() in the includes/subdomain.inc this way
/**
* Prepares subdomain for saving
*/
function clean($raw) {
// Replace spaces with dashes] & convert to lower case. If Transliteration module is installed, use it
if (function_exists('transliteration_clean_filename')) {
return strtolower(str_replace("_", "-",transliteration_clean_filename($raw, language_default('language'))));
} else {
$raw = strtolower(str_replace(" ", "-", $raw));
return preg_replace("/[^a-z-]/", "", $raw);
}
}
I even suggest to add to subdomain settings dropdown "use dash or underscore in the subdomain urls?" and use it in the 3rd row of the function to replace underscores with dashes or not.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | subdomain-transliteration-1075682-1.patch | 1.95 KB | rwohleb |
Comments
Comment #1
rwohlebHere is a patch that adds transliteration support if the module exists, as well as adds better support for RFC 952 and RFC 1123.
The RFC 1123 support is only exposed as a variable at the moment and is left for advanced users who need to support subdomains starting with a numeral. The default is to not support RFC 1123 since it leads to ugly subdomains.
Comment #2
Cray Flatline commentedThanks! really great!
But you've forgot to remove next rows from patch ;)
+ dpr($raw);
+ dpr($clean);
Comment #3
rwohlebDoh! Ok, I'll try to roll a clean patch tomorrow.
Comment #4
rwohlebThis has been committed (c0b2df4).