Page 1 of 1

Pretty URL problem

Posted: Thu Feb 14, 2008 5:04 pm
by bazzlad
Small quick problem here, when using pretty urls via config.php (not .htaccess) it's working like this:

www.sitename.com/index.php/pagetitle.html

I'd like it to work like this:

www.sitename.com/pagetitle.html


Here's my config.php - what am I doing wrong?
--------------
#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'] = '.html';

#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'] = true;

#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';
---------------

Re: Pretty URL problem

Posted: Thu Feb 14, 2008 6:58 pm
by nivekiam
To get that, you need to use mod_rewrite, which means editing .htaccess and config.php

Set this to true:
$config['assume_mod_rewrite'] = true;

Change this to false
$config['internal_pretty_urls'] = false;

At the very minimum add this to your .htaccess file:

# BEGIN CMSMS and Rewrite Rules
# Make sure you have Options FollowSymLinks
# and Allow on

RewriteEngine On

# Might be needed in a subdirectory
#RewriteBase /

# CMSMS Rewriting
# Set assume mod_rewrite to true in config.php and clear CMSMS cache
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
# END CMSMS

# END Rewrite rules

You may want to add in URL filtering for a little added security.  See the optional settings for more options, including what I've pasted above:
http://wiki.cmsmadesimple.org/index.php ... l_Settings