Different page file names for each page generated by CMSMS.

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
bjits
New Member
New Member
Posts: 7
Joined: Thu Jul 19, 2007 7:54 pm

Different page file names for each page generated by CMSMS.

Post by bjits »

Hi,

While I was reading some post on the forum, I found a CMSMS website example.

With this website http://www.shepwayonline.co.uk, how did the developer manage to get the different page file names. Like if you click on Our Services then how it is going to http://www.shepwayonline.co.uk/services.php. In the CMSMS what I have installed, if I click on some menu then it goes to
http://www.somewebsite.com/index.php?page=services.

Is there any configuration settings in the CMSMS or this is some customisation in the code done by the developer. I tried to ask the developer but haven't got any response.

Any help will be appreciated.

Regards,

Jitu
cyberman

Re: Different page file names for each page generated by CMSMS.

Post by cyberman »

bjits wrote: Is there any configuration settings in the CMSMS or this is some customisation in the code done by the developer.
There are some configuration settings inside config.php which you can use to do that
#Show mod_rewrite URLs in the menu? You must enable 'use_hierarchy' for this to work for modules
$config['assume_mod_rewrite'] = false;

#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '';

#If you don't use mod_rewrite, then would you like to use the built-in
#pretty url mechanism?  This will not work with IIS and the {metadata} tag
#should be in all of your templates before enabling.
$config['internal_pretty_urls'] = false;

#If you're using the internal pretty url mechanism or mod_rewrite, would you like to
#show urls in their hierarchy?  (ex. http://www.mysite.com/parent/parent/childpage)
$config['use_hierarchy'] = false;
The technologie / the server module behind is named mod_rewrite. You will found a lot of threads on searching.
Pierre M.

Re: Different page file names for each page generated by CMSMS.

Post by Pierre M. »

Hello,
bjits wrote: ...it is going to http://www.s.com/services.php. In the CMSMS what I have installed, if I click on some menu then it goes to
http://www.s.com/index.php?page=services.
this feature is called pretty URLs.
http://wiki.cmsmadesimple.org/index.php ... l_Settings
It is available with Apache and Lighttpd. Not with IIS.

Pierre M.
tgmayfield
Forum Members
Forum Members
Posts: 11
Joined: Tue Apr 24, 2007 5:51 pm

Re: Different page file names for each page generated by CMSMS.

Post by tgmayfield »

To pull off the bit you just described, here's how I would write the mod_rewrite rules (in .htaccess):

Code: Select all

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)\.php index.php?page=$1 [QSA]
This should be coupled with changing config.php:

Code: Select all

#Show mod_rewrite URLs in the menu? You must enable 'use_hierarchy' for this to work for modules
$config['assume_mod_rewrite'] = true;

#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '.php';

#If you don't use mod_rewrite, then would you like to use the built-in
#pretty url mechanism?  This will not work with IIS and the {metadata} tag
#should be in all of your templates before enabling.
$config['internal_pretty_urls'] = false;

#If you're using the internal pretty url mechanism or mod_rewrite, would you like to
#show urls in their hierarchy?  (ex. http://www.mysite.com/parent/parent/childpage)
$config['use_hierarchy'] = false;

#If using none of the above options, what should we be using for the query string
#variable?  (ex. http://www.mysite.com/index.php?page=somecontent)
$config['query_var'] = 'page';
I've not tested this, so it might require a bit of tweaking. All that said, the standard pretty URLs are much prettier than engineering everything to have a .php extension. http://wiki.cmsmadesimple.org/index.php/FAQ/Installation/Pretty_URLs

--Thomas
Post Reply

Return to “Developers Discussion”