Add Page Categories / Slugs

ashmetry

New Member
By default pages are /page/<page name>.

It would be good to change "page" from the URL and add other slugs like "articles", or "news" or anything else.

(this maybe a good plugin and not a core feature?)

Thanks
 

Basti

Administrator
Staff member
Cant possibly in the core. As you need to alter htaccess quite a bit
Code:
RewriteRule ^page/(.*)/ index.php?a=page&id=$1 [L]
Now even if you add all the different rules to htaccess
Code:
RewriteRule ^page/(.*)/ index.php?a=page&id=$1 [L]
RewriteRule ^articles/(.*)/ index.php?a=page&id=$1 [L]
RewriteRule ^news/(.*)/ index.php?a=page&id=$1 [L]
The code has no way to difference between these different structures. All pages would be accessable through page, articles, news resulting in bad double content

So, what is the solution? you would need to insert each and every page you create manually into htaccess so it can be identified
Code:
RewriteRule ^page/my-page-1/ index.php?a=page&id=my-page-1 [L]
RewriteRule ^page/my-page-2/ index.php?a=page&id=my-page-2 [L]

RewriteRule ^articles/article-1/ index.php?a=page&id=article-1 [L]
RewriteRule ^articles/article-2/ index.php?a=page&id=article-2 [L]

RewriteRule ^news/news-1/ index.php?a=page&id=news-1 [L]
RewriteRule ^news/news-2/ index.php?a=page&id=news-2 [L]
As you see, this is not really nice

-------------------------------------------------------

If all you want is is changing "page" to "articles", it is perfectly fine just to change the default
Code:
RewriteRule ^page/(.*)/ index.php?a=page&id=$1 [L]
-------------------------------------------------------

If its about having multiple, so choosing either from the admin panel, there are only 2 options

1) create a plugin which duplicates the page behavour as new admin pages. Honestly this would properly be the easiest

2) Alter the core to include a select option as to what is the type of the page
In this case pages HAVE to look like
page/page-id/ for normal pages when no type is selected
page/articles/page-id/ when article is selected as type
page/news/page-id/ when type is news

---------------------------------------------

If we do option 2 as core edit, people will come requesting 100's of different types. This is not good.
For the masses just having a custom page is usually enough and therefore having a plugin to extent your own list might be the better choice

So, having option 2 as a plugin which extends the default page behavour would be the best in my opinion. But you would be stuck with the urls like i posted at option 2.
If other url structure would be needed only option 1 can do it

------------------------------------------

So either way, since this as core edit, at least for now, isnt suitableill move this to plugin requests
 
Last edited:

Mark

Administrator
Staff member
The other option is to create URL routing table, but this gets REALLY server intensive on larger sites with lots of possible routes. Our current method favors performance over flexibility.

Maybe this can be considered in Version 2.o (maybe using klein.php or a similar class that is fast and well tested), but its a major change no doubt.
 
Top