Skip to main content Help Control Panel

YACS CMS : Open source !

Community «   Discussion forum «   Post your requirements here «  

Sections as dirs

Cordeiro, Derek -- on June 10 2007
How can I use sections as folders "http://servername/sectionname"

If I create a section, the section url becomes something like "http://servername/sections/view.php/<section-id>"

I want to be able to use an alternate url of the form "http://servername/sectionname"

for example If I create a section on a site say http://sportsite.info for sports. If I create sections named football, cricket, etc with IDs 7,8,etc resp the urls are  http://sportsite.info/sections/view.php/7 and http://sportsite.info/sections/view.php/8

A better descriptive url would be http://sportsite.info/football and http://sportsite.info/cricket

Is it there any way to accomplish this?

(I am interested in creating a site on villages of a state, a descriptive url is much preferred)

NickR
avatar
from West Yorkshire, UK
342 posts

on June 12 2007


Hi, we currently can not do this.

I also know it would be a BIG job to do, as the code to do this has to be written into the architecture to handle ALL the urls centrally and in a standardised way, and would need a rewrite of a LOT of code. There is also a large performance cost to this, as every page has to have additional processing just to map the url to the correct php file (and this has to be done dynamically and structured and requires a general page handling framework which adds it own complexity, rules and overhead).

It would be nice to do it (like ruby on rails does), but the amount of time it would take compared to the benifit IMHO is not worth it (or I would of started work on this myself along time ago) and our time is better spent on other features.
-----
Nick
Fad
67 posts

on June 12 2007


Ther's a way :

Modify the section using the "edit" link.

Under "Advanced options" -> "Nick name" give a name. Let's say "football".

You may call this section by using the page selector : http://[yoursite]/go.php/football

Fad

Derek
7 posts

on June 12 2007


@Fad:

Thanks a lot!

 

Bernard
avatar
from nearby-an-airport
Associate, 6995 posts

on June 12 2007


Actually the transformation you are looking for is done by Apache itself, based on directives placed in a file called .htaccess. If your ISP supports the so-called URL rewriting technology, then you may create a suitable .htaccess to detect http://my_site/football and to trigger http://my_site/yacs/sections/view.php/234 or whatever YACS page you want.

Or, if you may wait for some weeks, this will be available in the next standard YACS release...
NickR
avatar
from West Yorkshire, UK
342 posts

on June 12 2007


Bernard, I totally forgot, I did some htaccess rules last year !

Bernard - Shorter URLS
-----
Nick
Derek
7 posts

on June 13 2007


Thats really good news, I assume that will be Yacs 7.5.

NickR
avatar
from West Yorkshire, UK
342 posts

on June 13 2007


Hi, 7.5 (7 denotes the year, 5 the month of the year)- there was a message somewhere from Bernard that 7.5 has become 7.6, I am guessing 7.6 will be out towards the end of this month.
-----
Nick
Bernard
avatar
from nearby-an-airport
Associate, 6995 posts

inspired from NickR on June 13 2007


NickR: I have used the same approach, based on rewriting rules in .htaccess. Should I comment these lines out in the file provided in the archive? In a number of places complew .htaccess may just kill the server with 500 internal errors...
NickR
avatar
from West Yorkshire, UK
342 posts

on June 13 2007


The .htaccess rules I wrote, please ignore, as you have written your own.

Could you please explain these error 500 ?

Thanks.
-----
Nick
Bernard
avatar
from nearby-an-airport
Associate, 6995 posts

inspired from NickR on June 28 2007


NickR: As you may know, the 500 status code, that is defined in the HTTP protocol, denotes some internal error, diferent from 404 (page not found), 302 (redirected), etc. Actually quite often the Apache server returns a 500 Internal Error when the content of .htaccess does not comply with global security statements set for the full web service. The flexibility of Apache is great, except when some ISPs decide to limit the directive you can use in .htaccess. This may create 500 Internal Errors, and it is not so easy to troubleshoot, since you may have little access to the Apache error log file...
AnsteyER
avatar
301 posts

inspired from Bernard on June 30 2007


You know... this might be weird, but I'll toss it out there. On my work site, we wanted to emulate a directory tree structure with a single page and used apache and php to fake the tree by parsing a page without the .php then converting the url into a query string, etc.

example might be a file called /home

if you used the address /home/contest that would behave like: home.php?location=contest

and lookup and load that page.

I don't know if that's relevant...except that right now you have all these urls with the .php that look sort of funky.

I'm sure you already know that trick, but I thought i'd toss it out there.
Bernard
avatar
from nearby-an-airport
Associate, 6995 posts

inspired from ansteyER on Jul. 1 2007


AnsteyER: Not so weird, and really useful... We are using that in YACS as well, to mask .php extensions as much as possible. Featured in version 7.6, soon to be released...

 
Share
Information channels
Recent files