[solved] mod_rewrite pretty URLs not working

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
ntmr
Forum Members
Forum Members
Posts: 16
Joined: Wed Aug 05, 2009 12:27 am

[solved] mod_rewrite pretty URLs not working

Post by ntmr »

A common problem, maybe, but I've got it in any case.  ;D

So, I'm running a XAMPP package plus CMS Made Simple: CMSms 1.6.3, PHP 5.2.9, MySQL 5.0.51a  (I think that's the version), and Apache 2.2.11.

My .htaccess for CMSms reads like this, taken from \doc\htaccess.txt:

Code: Select all

# Attempt to override some php settings, these settings may be helpful on some hosts if your
# default configuration does not meet CMS's minimum requirements, and your host
# has given your account appropriate permissions
#php_value upload_max_filesize "10M"
#php_value session_save_path "tmp/cache"

#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
#php_flag session.use_trans_sid Off

# (this is important, so uncomment if your host permit)
#Options -Indexes
#ServerSignature Off
#
Options +FollowSymLinks
#
<IfModule mod_rewrite.c>
RewriteEngine on
#
#Sub-dir e.g: /cmsms
RewriteBase /
#
# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
#RewriteCond %{REQUEST_URI} !/$
#RewriteCond %{REQUEST_URI} !\.
#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>
I have an AllowOverride All directive set in httpd.conf for the directory:

Code: Select all

<Directory "c:/nathaniel/cmsmadesimple">
    AllowOverride All
I was getting 404s on content pages and Forbiddens all around (including admin area) using some different code that had been suggested elsewhere. With the current .htaccess, I get redirected to the server doc root, which a XAMPP .htaccess redirects to /xampp (which is supposed to happen).

And I know for sure mod_rewrite is on because I have checked it in httpd.conf before and it gets loaded and I've gotten WordPress pretty URLs working with this same server and this code in httpd.conf:

Code: Select all

<Directory "c:/nathaniel/wordpress">
	Options FollowSymLinks
	AllowOverride FileInfo
Anyway, that's sightly irrelevant, but my point is that I think mod_rewrite itself is working.

Any ideas on getting this working?

Edit: Not to mention, I've got config.php configured:

Code: Select all

$config['url_rewriting'] = 'mod_rewrite';
and

Code: Select all

$config['assume_mod_rewrite'] = true;
#$config['internal_pretty_urls'] = false;
Last edited by ntmr on Tue Sep 15, 2009 11:59 pm, edited 1 time in total.
ntmr
Forum Members
Forum Members
Posts: 16
Joined: Wed Aug 05, 2009 12:27 am

Re: mod_rewrite pretty URLs not working

Post by ntmr »

'Scuse me, but... BUMP!  ;D
alby

Re: mod_rewrite pretty URLs not working

Post by alby »

ntmr wrote:
#Sub-dir e.g: /cmsms
RewriteBase /
I have an AllowOverride All directive set in httpd.conf for the directory:

Code: Select all

<Directory "c:/nathaniel/cmsmadesimple">
    AllowOverride All
Are you sure that is right or is /cmsmadesimple?

ntmr wrote:

Code: Select all

$config['assume_mod_rewrite'] = true;
#$config['internal_pretty_urls'] = false;
Drop there rows (pre 1.6)

Alby
ntmr
Forum Members
Forum Members
Posts: 16
Joined: Wed Aug 05, 2009 12:27 am

Re: mod_rewrite pretty URLs not working

Post by ntmr »

alby wrote:
Are you sure that is right or is /cmsmadesimple?
Yeah, I think I had it right, since that's where I have CMS Made Simple running. I just changed it to /nathaniel/cmsmadesimple, though, since I have the alias /nathaniel set up for c:/nathaniel, for convenience.
alby wrote:
ntmr wrote:

Code: Select all

$config['assume_mod_rewrite'] = true;
#$config['internal_pretty_urls'] = false;
Drop there rows (pre 1.6)

Alby
Done.

So, neither of the changes made a difference. I'm still getting redirected to the server root if I try to access any of the pages besides my default page.

Edit: By the way, I am clearning my CMSms cache after I change some config.php settings, so that one is ruled out.
Last edited by ntmr on Sat Aug 22, 2009 11:39 pm, edited 1 time in total.
ntmr
Forum Members
Forum Members
Posts: 16
Joined: Wed Aug 05, 2009 12:27 am

Re: mod_rewrite pretty URLs not working

Post by ntmr »

BTW, I never did solve this locally, but I bet I could have got it to work, because once it was online I did get it to work. I believe the key issue was missing metadata - I forgot to put it in one of my templates (have two - one for pages and one for front page) and added it later on. Anyway, I tried it with the online version using the .htaccess code here and bam! it worked.
Post Reply

Return to “CMSMS Core”