Forums / Cotonti / Support / Rewrite URLs

How does this work?

GHengeveld
#1 2009-02-03 04:27
In the past I've done some custom URL rewriting with .htaccess on Seditio. I'm very pleased there is a module for that now, that could save me some time.

I am now trying to figure out how the rewriting system works in Cotonti, and fortunately it is quite well documented in the Help, but still I'm not quite sure it works the way I think it does. I don't like messing up my website so I would like to see an example of a working rewrite.

I noticed that Cotonti.com is using this, so perhaps someone could take a screenshot of the rules that Cotonti.com has set up ?
Trustmaster
#2 2009-02-03 04:33
Sharing the urls is easy: they all are saved in a file datas/urltrans.dat. No need for screenshots, etc.

Cotonti.com URLs are not yet complete. We need to add forums and other sections, also some changes should be made in the URLtrans engine to support such massive customizations. And then Kilandor will publish them with a tutorial how it was done.

For now, we can make some simple examples within a few days.
May the Source be with you!
Brock
#3 2009-02-03 05:15
I really think this is the best feature of Cotonti so far. I really can't wait until it's complete and well documented, so everyone knows how to use it. It will help SEO tremendously.
Web Design Database - www.wddb.com
GHengeveld
#4 2009-02-03 05:22
If you take a look at Coolclocks.nl you will see that URL rewriting is certainly possible with Seditio, so its not really that big a change. Rewriting Seditio unfortunately requires core hacking, so the fact that Cotonti has this by default is definately a big plus.

I'm currently translating the part of admin.lang.php about the URL rewriting module to dutch, but it requires good knowledge of the way it works.
Brock
#5 2009-02-03 05:34
Actually, if you look at my site, wddb.com, you will see me using a URL rewrite hack I found on SeditioForge. I think it was pretty good, but if it was part of the core, it would be far better. That's why I am excited about the release of it inside of Cotonti. I tried to mess around with it one day, but didn't get very far. Hopefully next time I try it, I will have more success.
Web Design Database - www.wddb.com
GHengeveld
#6 2009-02-03 06:40
I've been fiddling around with the rewriting system. I've copied some of the rules from Cotonti.com but I am getting this error message:
Rule contains callbacks: {username_url_structure()}
Rule contains callbacks: {page_url_structure()}
Rule contains callbacks: {list_url_structure()}
You will have to add rewrite options for them manually.
It would be nice if someone could explain what this 'callback' is exactly, because I don't really understand what is meant by this.
Also, when I visit index.php, I get a fatal error:
Fatal error: Call to undefined function list_url_structure() in 
/home/db045b0018/domains/ghengeveld.nl/public_html/squadraat/Squadraat_Cotonti/system/functions.php 
on line 4341
Trustmaster
#7 2009-02-03 16:07
Callbacks are custom functions which are called when generating the urls. E.g. {page_url_structure()} is replaced with result of page_url_structure(&$args), where page_url_structure() is a custom user-defined function. Those functions you're missing are contained in an extra include file.

Also the warnings "Rule contains callbacks" means that URL designer tool doesn't have so much Artificial Intelligence to write .htaccess rules for them, so you have to make .htaccess rules for callbacks by hand.
May the Source be with you!
Kilandor
#8 2009-02-03 17:32
Evil, you spied on our urltrans.dat file :)

But thats the easy part, the actual functions are where the good stuff happens :)
GHengeveld
#9 2009-02-04 21:56
Any chance you could give an example on how such a function would work? Or even better, show us the function(s) you're using.
Trustmaster
#10 2009-02-04 22:31
Well, the reason we are so slow at it, is that it is not yet complete :-)
May the Source be with you!