[Solved] Problem with Pretty URLs

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
Neow
Forum Members
Forum Members
Posts: 33
Joined: Wed Nov 19, 2008 1:39 pm

[Solved] Problem with Pretty URLs

Post by Neow »

Hi,

I got a problem since I've tried to use the Pretty Url. I've followed the instructions in the CMSMS wiki :

config.php

Code: Select all

#What type of URL rewriting should we be using for pretty URLs?  Valid options are:
#'none', 'internal', and 'mod_rewrite'.  'internal' will not work with IIS some CGI
#configurations. 'mod_rewrite' requires proper apache configuration, a valid
#.htaccess file and most likely {metadata} in your page templates.  For more
#information, see:
#http://wiki.cmsmadesimple.org/index.php/FAQ/Installation/Pretty_URLs#Pretty_URL.27s
$config['url_rewriting'] = 'mod_rewrite';

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

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

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

Code: Select all

Options -Indexes


Options +FollowSymLinks
#
<IfModule mod_rewrite.c>
RewriteEngine on
#
#Sub-dir e.g: /cmsms
RewriteBase /cms/

#
# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# but ignore POST requests.
#RewriteCond %{REQUEST_URI} !/$
#RewriteCond %{REQUEST_URI} !\.
#RewriteCond %{REQUEST_METHOD} !POST$
#RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>
But when I go to the website, I only obtain empty pages. I searched on the forum but I can't find any solution. Any ideas ?

Other question : the CMS is installed in a cms/ subdirectory. How can I redirect the index of the website to cms/index.php ? I've tried to add a DirectoryIndex in the .htaccess file but it doesn't work.

Thanks !
Last edited by Neow on Sun Jan 24, 2010 9:27 am, edited 1 time in total.
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Problem with Pretty URLs

Post by Nullig »

RewriteBase /cms

Nullig
Neow
Forum Members
Forum Members
Posts: 33
Joined: Wed Nov 19, 2008 1:39 pm

Re: Problem with Pretty URLs

Post by Neow »

Doesn't change anything.
Ziggywigged
Power Poster
Power Poster
Posts: 424
Joined: Sat Feb 02, 2008 12:42 am

Re: Problem with Pretty URLs

Post by Ziggywigged »

He means you should check that it matches your configuration.
E.g. Is your site in a sub-directory?
If not, then just use:
RewriteBase /
Take a penny, leave a penny.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Problem with Pretty URLs

Post by Dr.CSS »

If the site is in the root comment out the RewriteBase / part, and / is not a file extension, it has been known to create problems, why not have your pages end in .html, .php or some real page extension...
Neow
Forum Members
Forum Members
Posts: 33
Joined: Wed Nov 19, 2008 1:39 pm

Re: Problem with Pretty URLs

Post by Neow »

I've tried to use .htm extension instead of / it doesn't change anything.
My site is in a subdirectory  /www/cms/ and .htaccess is in /www/.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Problem with Pretty URLs

Post by Dr.CSS »

Ok if it is a subfolder then you need to put the .hraccess in that folder and use...

RewriteBase / cms
Neow
Forum Members
Forum Members
Posts: 33
Joined: Wed Nov 19, 2008 1:39 pm

Re: Problem with Pretty URLs

Post by Neow »

It works. Thanks.
Locked

Return to “[locked] Installation, Setup and Upgrade”