Forums / Developer / Change the URL/URI separator

Change the URL/URI separator

Author Message

Dominic Luechinger

Thursday 28 December 2006 4:25:07 pm

Is there a possibility to change the URL separator (by default: "_") in the ez publish.
The problem is, that this constitution isn't usefull for SEO (Search engine optimization), because a link like http://ez.no/company/contact_form will be interpreteted as "contact_form" and not as "contact","form".
See more on: http://www.prweaver.com/blog/2004/08/26/2-hyphen-and-underscore

Thank's

kracker (the)

Friday 29 December 2006 2:23:23 am

I've heard a lot of talk about this feature request.
I hear it's ... complicated and deeply involved.

That said back in 2003 it did not seem so complicated,
<i>http://ez.no/community/forum/setup_design/nice_url_delimiter_change_to_</i>

While the above thread is 'a' starting point,
It seems much of this functionality has since been abstracted a few times.

Follow the php code's execution order...
file, 'kernel/classes/ezcontentobjecttreenode.php', function 'pathWithNames()'
file, 'kernel/classes/ezurlalias.php', function 'convertToAlias()'

  /*!
     \static
     Converts the path \a $urlElement into a new alias url which only conists of characters
     in the range a-z, numbers and _.
     All other characters are converted to _.
     \return the converted element

     \example
     'My car' => 'my_car'
     'What is this?' => 'what_is_this'
     'This & that' => 'this_that'
     'myfile.tpl' => 'myfile_tpl',
     '<F8><E6><E5>' => 'oeaeaa'
     \endexample
    */
    function convertToAlias( $urlElement, $defaultValue = false )
    {
        include_once( 'lib/ezi18n/classes/ezchartransform.php' );
        $trans =& eZCharTransform::instance();

        $urlElement = $trans->transformByGroup( $urlElement, 'urlalias' );
        if ( strlen( $urlElement ) == 0 )
        {
            if ( $defaultValue === false )
                $urlElement = '_1';
            else
            {
                $urlElement = $defaultValue;
                $urlElement = $trans->transformByGroup( $urlElement, 'urlalias' );
            }
        }
        return $urlElement;
    }

file, 'lib/ezi18n/classes/ezchartransform.php', function 'transformByGroup()'
file, 'lib/ezi18n/classes/ezcodemapper.php', function 'executeCommandCode()'

 function executeCommandCode( &$text, $command, $charsetName )
    {
        if ( $command['command'] == 'url_cleanup' or
             $command['command'] == 'identifier_cleanup' )
        {
            $text = strtolower( $text );
            $text = preg_replace( array( "#[^a-z0-9_ ]#",
                                         "/ /",
                                         "/__+/",
                                         "/^_|_$/" ),
                                  array( " ",
                                         "_",
                                         "_",
                                         "" ),
                                  $text );
            return true;
        }

I believe with some tinkering around here and perhapses a few other locations in the code (one edit for interpretation and one edit for generation ... of-urls-using-dashes-rather-than-underscores) the theory is it's possible. Though this could open up other as of yet unknown breakdowns resulting from these modifications which would need to be addressed for a complete solution.

<i>//kracker
the lifestyle of private modifications which never see distribution is a sad one indeed ... contribute to your local community!</i>

<b>Related threads</b>
<i>http://ez.no/community/forum/general/usability_and_seo
http://ez.no/community/forum/suggestions/url_rewriting_and_whitespaces
http://ez.no/community/forum/general/seo_and_page_head
http://ez.no/community/forum/suggestions/better_urls</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

eZ debug

Timing: Jan 21 2025 20:52:12
Script start
Timing: Jan 21 2025 20:52:12
Module start 'content'
Timing: Jan 21 2025 20:52:12
Module end 'content'
Timing: Jan 21 2025 20:52:12
Script end

Main resources:

Total runtime0.2879 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0076 587.7109180.8359
Module start 'content' 0.00760.0059 768.546997.9922
Module end 'content' 0.01350.2744 866.5391526.2734
Script end 0.2879  1,392.8125 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00351.2187200.0002
Check MTime0.00130.4665200.0001
Mysql Total
Database connection0.00100.333410.0010
Mysqli_queries0.240083.35211410.0017
Looping result0.00140.48081390.0000
Template Total0.274095.210.2740
Template load0.00080.276510.0008
Template processing0.273294.889410.2732
Override
Cache load0.00050.180910.0005
Sytem overhead
Fetch class attribute can translate value0.00080.276110.0008
XML
Image XML parsing0.00030.114910.0003
General
dbfile0.00441.5391200.0002
String conversion0.00000.005930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs