eZ Community » Forums » Setup & design » nice URLs
expandshrink

nice URLs

nice URLs

Thursday 27 March 2003 6:06:07 am - 13 replies

First of all congrats to the ez crew on the release of ez Publish 3.0. Fixes a lot of issue we have ben having and includes a more easy to use admin section.

I notice that the new ez site has nice URLs like http://developer.ez.no/developer/forums

How is this accomplished? I'm assuming the ez site uses ez3 of course.

Thanks
Bruce

Thursday 27 March 2003 9:22:19 am

The nice url's is a built in automatic feature of eZ publish 3. When building urls in the template you just need to as for url_alias from the node. E.g. <a href={$node.url_alias|ezurl}>link</a>.

the ezurl operator will fix any prepending needed to the url.

--bård

Thursday 27 March 2003 12:19:12 pm

Where do you fill this url_alias field?
Where is defined?

Thursday 27 March 2003 12:30:31 pm

When you change the templates for eZ publish you get access to the node. So in e.g. line.tpl you can change the link to the node to use the automatic url conversion. In the template you can access this by:
{$node.url_alias}

The url alias is automatically generated from the object names of the parent object, i.e. the "path". It will convert the name to lower case 0-9 a-z and _ characters.

--bård

Friday 28 March 2003 1:26:49 am

Ok I have the system generating the URLs but I suspect there is a little more to it.

In site.ini there is this section

[URLTranslator]
# Use either enabled or disabled
Translation=enabled
# Enable this if you want to percieve the url as a path element
# for the node tree. By entering the path in the url and ending it
# with a .html you will get the correct node.
NodeTranslator=enabled

I've cleared the ini cache but I'm still getting

Module not found

* The requested module 'frontpage20' could not be found.

and the URL
http://dit.dev-linux-1/user/frontpage20/articles/new_article
(internal site)

What am I missing?

Cheers
Bruce

Friday 28 March 2003 9:19:41 am

Bruce,

I have been testing this and have not been able to get 'nice' urls... You are right there has to be something more to it.

Friday 28 March 2003 10:28:52 am

I just downloaded the 3.0 dist to see why you didn't get this to work. And the solution is simple, put this in site.ini

[URLTranslator]
Translation=enabled
NodeTranslation=enabled

NOTE: 3.0 has a typo in the released site.ini NodeTranslation is spelled wrong. It says NodeTranslator as default, this is wrong.

Hopefully now, you can enjoy human readable URLs.

--bård

Friday 28 March 2003 10:48:54 am

Yep that works... Thanks

any idea when we can implement URL mapping like in 2.x

i.e. '/about' = '/content/view/full/99/'

Friday 28 March 2003 11:11:51 am

URL translation is on our todo, but we haven't decided when to do this. Actually we've found that the built in URL translations is better to use since the URLs will map directly to the site structure.

We will have an announcement about what we will focus on for 3.1 soon. This will of course be open for discussion.

--bård

Monday 31 March 2003 6:16:30 am

I did find and ran update/common/scripts/updateniceurls.php to get this working.

Is this due to the site bening updated from RC2 ?

Wednesday 02 April 2003 10:35:07 pm

So I followed your note above about enabling URLTranslation. So where should it appear on what admin page? I look through all the admin temlpate files and nothing about URL Translation appears. Where do these mappings go?

And not to get lost in translation, I want to make /aboutus go to the right page /content/view/....

Thanks

Monday 21 April 2003 1:32:03 pm

I think you want http://www.example.com/aboutus to be directed to a certain page. It sounds like eZp3 does not have that "url translation" feature which was in eZp2. You'll have to use web server Rewrite rules (or something like aboutus.html with a redirect) to do the translation.

I'll also point out that a previous comment mentioned that URLs are created based on node names, but the phrasing was a little obtuse. A name "Archive of Old News Articles" appears as "archive_of_old_news_articles". It would be nice to be able to define a "label" for items, so with a label of "newsarchive", a URL like "news/newsarchive" would appear instead of "public_relations_announcements/archive_of_old_news_articles" (obviously, with the "Public Relations Announcements" page having a label of "news"blunk.gif Emoticon.

Tuesday 22 April 2003 10:12:18 am

What about configuring mod_rewrite to map /about to /content/view/... ?

Tuesday 03 June 2003 10:17:50 pm

I used the solution above, I tried "ezurl" and "ezroot".
All urls in my project becomes like "http://www.ez.no/developer/ez_pub...m/setup_design/all_about_ezurl" or like "http://www.ez.no/index.pph/develo...m/setup_design/all_about_ezurl".
But I still see "Module not found".
When I create articles in Russian language, url becomes like "index.php/news/frontpage/__1"? Why?

Can anyone give me step-by-step solution?

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu