How to build in pretty_url

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
Duketown

How to build in pretty_url

Post by Duketown »

Hi,

There are a couple of requests for my modules, to have them write pretty_urls. Where can I find an example of that.
I've seen the News version. Is there maybe another example of coding without the 'autodiscoverylink' part?

Thanks in advance,

Duketown
viebig

Re: How to build in pretty_url

Post by viebig »

I usually use htaccess to create prettier urls.

I put an option at the module like: Use mod_rewrite

then with a couple on line added to htaccess you can generate the the way you want. Not to easy for the user to setup because requires editing the .htaccess, but more flexible and light than process everything with PHP.

You can even generated the needed .htaccess addition, so basically it will be copy and paste.

Further, you can implement a flexible way to create urls, like: an user input:

Code: Select all

%cat_name%/%item_name-%item_id%/
then for example your module generated a code links like:

/categoryname/item-name-5/

parsing the scheme you can generate some mod_rewrite codes.

I hope that is useful, since it's a non-standard way.

Regards

G
bob_basli
Forum Members
Forum Members
Posts: 189
Joined: Mon Sep 24, 2007 6:18 pm

Re: How to build in pretty_url

Post by bob_basli »

viebig wrote:
Further, you can implement a flexible way to create urls, like: an user input:

Code: Select all

%cat_name%/%item_name-%item_id%/
then for example your module generated a code links like:

/categoryname/item-name-5/
How do I implement this in my .htaccess??
Post Reply

Return to “Developers Discussion”