Forums / General / URL's with "Underscores" instead of "Hyphens"

URL's with "Underscores" instead of "Hyphens"

Author Message

John Smith

Friday 17 October 2008 4:38:54 am

Hi There,

Hope some one can help. Actually I installed ezpubish4.0.1 around some time ago. By default all the URLs are with separator "hyphen". But now I want to convert all the URLs with separator "underscore".

Is there any easy way to do it.

Another thing is it possible to install the future ezpublish with urls/underscores by default.

Cheers

Jean-Luc Nguyen

Friday 17 October 2008 6:59:08 am

You will find more info on custom urls on /settings/transform.ini:

Redefinining a new TransformationGroup on site.ini (only an example):

[URLTranslator]
WordSeparator=dash
TransformationGroup=urlalias_lowercase

And then creating a new transform.ini.append.php, which will take over the default one:

[Transformation]
Groups[]=urlalias_lowercase

[urlalias_lowercase]
# Extra transformation files for urlalias
Files[]
# Extensions that have transformation files when urlalias is used
Extensions[]
# The commands to use for search
Commands[]
Commands[]=normalize
Commands[]=transform
Commands[]=decompose
Commands[]=transliterate
Commands[]=diacritical
Commands[]=url_cleanup
Commands[]=lowercase

This is only an example, you can combine commands, and you will find more info on default file transform.ini

http://www.acidre.com

John Smith

Friday 17 October 2008 7:03:11 am

Thanks for your kind help.

Do I need to run any script after doing the changes in the INI files or the system will pick automatically.

Carlos Revillo

Friday 17 October 2008 10:12:22 am

after changes suggested by Jean-Luc, all your new contest will get a nice url with underscores.
for changing the old ones, you will need to run

php bin/php/updateniceurls.php -s yoursiteacces

from your Document Root

clear caches after that. sometimes i have truncated ezurlalias_ml table before running... i think the updateniceurls.php doesn't delete old entries, so i prefer delete them by myself...

hope it helps.

Maarten Holland

Sunday 19 October 2008 2:50:42 am

"Another thing is it possible to install the future ezpublish with urls/underscores by default."

I do this by uncommenting the line:

TransformationGroup=urlalias_compat

in 'site.ini'. It still creates a few URL's with capitals and hyphens instead of underscores (like /Users/Guest-Accounts) but by just 'editing' and 'publishing' those, the URL's get converted.

All new URL's are in /no_caps/using_underscore_for_separator format.

Hope this helps.