Pretty URL problem

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
bazzlad
Forum Members
Forum Members
Posts: 20
Joined: Tue May 29, 2007 7:12 pm

Pretty URL problem

Post 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';
---------------
nivekiam

Re: Pretty URL problem

Post 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
Post Reply

Return to “CMSMS Core”