somewhere in on the forum i once found this plugin (can’t find the thread anymore...):
Can document the alias in a friendly URL be made to work case-insensitive?
$alias= null;
if ($modx->config['friendly_alias_urls'] == 1) {
if (($modx->config['use_alias_path'] == 1 && $modx->documentMethod == 'alias' && $modx->event->name == 'OnPageNotFound')) {
$alias= (strlen($modx->virtualDir) > 0 ? $modx->virtualDir . '/' : '') . $modx->documentIdentifier;
}
elseif ($modx->event->name == 'OnWebPageInit') {
$alias= $modx->getDocumentIdentifier('alias');
}
}
if ($alias) {
if (!isset($modx->documentListing[$alias])) {
$documentListingNC= array_change_key_case($modx->documentListing);
if (isset($documentListingNC[strtolower($alias)])) {
$actualDocId= $documentListingNC[strtolower($alias)];
$modx->sendRedirect($modx->makeUrl($actualDocId), 0, '', 'HTTP/1.0 301 Moved Permanently');
exit();
}
}
}
$alias = null;
if ($modx->config['friendly_alias_urls'] == 1) {
if ($modx->config['use_alias_path'] == 1 &&
$modx->documentMethod == 'alias' &&
$modx->event->name == 'OnPageNotFound') {
$alias = (strlen($modx->virtualDir) > 0 ? $modx->virtualDir . '/' : '') . $modx->documentIdentifier;
}
elseif ($modx->event->name == 'OnWebPageInit') {
$alias= $modx->getDocumentIdentifier('alias');
}
}
if ($alias) {
$aliasParts = explode(".", $alias);
$aroot = $aliasParts[0]; // drop URL suffix
if (!isset($modx->documentListing[$aroot])) {
$documentListingNC = array_change_key_case($modx->documentListing);
if (isset($documentListingNC[strtolower($aroot)])) {
$actualDocId= $documentListingNC[strtolower($aroot)];
$modx->sendRedirect($modx->makeUrl($actualDocId), 0, '', 'HTTP/1.0 301 Moved Permanently');
exit();
}
}
}
If I call the page alias cRazYpaGE - it is stored as ’crazypage’ and all my links are lowercase. I assume wayfinder has nothing to do with it. Looks like they are converted to lc before they go in the database. This should be a fairly easy hack, pobably to the core, but I have no idea where to look.check your TransAlias Plugin settings
$aliasParts = explode(".", $alias);
$aroot = $aliasParts[0]; // drop URL suffix
if ($modx->config['friendly_url_suffix'] ){ //Are suffixes on?
$aliasParts = explode(".", $alias); //Yes, split into parts based on . delimiter
$aroot ='';
$acount = count($aliasParts);
$suffix=".";$i=0;
while ($i<$acount) { //Drop the last .xxx
if ($i == $acount-1) $suffix="";
$aroot.= $aliasParts[$i] . $suffix;
$i++;
}
}
else {
//No Suffix to remove
$aroot = $alias;
} $alias = null;
if ($modx->config['friendly_alias_urls'] == 1) {
if ($modx->config['use_alias_path'] == 1 &&
$modx->documentMethod == 'alias' &&
$modx->event->name == 'OnPageNotFound') {
$alias = (strlen($modx->virtualDir) > 0 ? $modx->virtualDir . '/' : '') . $modx->documentIdentifier;
}
elseif ($modx->event->name == 'OnWebPageInit') {
$alias= $modx->getDocumentIdentifier('alias');
}
}
if ($alias) {
if ($modx->config['friendly_url_suffix'] ){ //Are suffixes on?
$aliasParts = explode(".", $alias); //Yes, split into parts based on . delimiter
$aroot ='';$acount = count($aliasParts);$suffix=".";$i=0;
while ($i<$acount) { //Drop the last .xxx
if ($i == $acount-1) $suffix=""; //While i could do a substr post loop. this is actually faster
$aroot.= $aliasParts[$i] . $suffix;
$i++;
}
}
else {
//No Suffix to remove
$aroot = $alias;
}
if (!isset($modx->documentListing[$aroot])) {
$documentListingNC = array_change_key_case($modx->documentListing);
if (isset($documentListingNC[strtolower($aroot)])) {
$actualDocId= $documentListingNC[strtolower($aroot)];
$modx->sendRedirect($modx->makeUrl($actualDocId), 0, '', 'HTTP/1.0 301 Moved Permanently');
exit();
}
}
}if($mode=="new"){
$wuid = $username;
$table_name = $modx->getFullTableName( 'site_content' );
$fields = array(
'type' => 'document',
'contentType' => 'text/html',
'pagetitle' => $wuid,
'alias' => $wuid,
'published' => '1', //is the page published?
'parent' => '16', //what is the parent of this new page?
'isfolder' => '0', // lets make this a folder
'template' => '15', //type template id here
'cacheable' => '0',
'createdby' => $wuid,
'createdon' => time(),
'editedon' => time(),
'publishedon' => time(),
'hidemenu' => '1'
);
$modx->db->insert( $fields, $table_name); // put the fields in the db (id wil be created incremental.)
//Create placeholder and put the id in a session to use for mail or whatever.
$_SESSION['eigenpaginaid'] = $modx->db->getInsertId();
$modx->setPlaceholder('eigenpaginaid', $modx->db->getInsertId());
return;
}$alias = null;
if ($modx->config['friendly_alias_urls'] == 1) {
if ($modx->config['use_alias_path'] == 1 &&
$modx->documentMethod == 'alias' &&
$modx->event->name == 'OnPageNotFound') {
$alias = (strlen($modx->virtualDir) > 0 ? $modx->virtualDir . '/' : '') . $modx->documentIdentifier;
}
elseif ($modx->event->name == 'OnWebPageInit') {
$alias= $modx->getDocumentIdentifier('alias');
}
}
if ($alias) {
if ($modx->config['friendly_url_suffix'] ){ //Are suffixes on?
$aliasParts = explode(".", $alias); //Yes, split into parts based on . delimiter
$aroot ='';$acount = count($aliasParts);$suffix=".";$i=0;
while ($i<$acount) { //Drop the last .xxx
if ($i == $acount-1) $suffix=""; //While i could do a substr post loop. this is actually faster
$aroot.= $aliasParts[$i] . $suffix;
$i++;
}
}
else {
//No Suffix to remove
$aroot = $alias;
}
if (!isset($modx->documentListing[$aroot])) {
$documentListingNC = array_change_key_case($modx->documentListing);
if (isset($documentListingNC[strtolower($aroot)])) {
$actualDocId= $documentListingNC[strtolower($aroot)];
$modx->sendRedirect($modx->makeUrl($actualDocId), 0, '', 'HTTP/1.0 301 Moved Permanently');
exit();
}
}
}