Page 1 of 1
Different page file names for each page generated by CMSMS.
Posted: Fri Sep 07, 2007 5:02 am
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
Re: Different page file names for each page generated by CMSMS.
Posted: Fri Sep 07, 2007 6:37 am
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.
Re: Different page file names for each page generated by CMSMS.
Posted: Fri Sep 07, 2007 2:02 pm
by Pierre M.
Hello,
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.
Re: Different page file names for each page generated by CMSMS.
Posted: Sat Sep 08, 2007 10:01 pm
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