[solved] mod_rewrite not working!

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
wolphy
Forum Members
Forum Members
Posts: 33
Joined: Fri Sep 19, 2008 2:26 pm

[solved] mod_rewrite not working!

Post by wolphy »

I've done this successfully on two other websites and can't figure out what's going wrong here!  Can anyone help me?!

Details:

Hosting on Bluehost


CMS Version  1.5.3



config.php code

#------------
#URL Settings
#------------

#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'] = '.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'] = 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'] = 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
Options +FollowSymLinks
RewriteEngine on
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 ^(.+).html$ index.php?page=$1 [QSA]
SetEnv TZ America/New_York

#option to remove directory listings in this folder
Options -Indexes
Last edited by wolphy on Wed Mar 18, 2009 12:11 pm, edited 1 time in total.
wolphy
Forum Members
Forum Members
Posts: 33
Joined: Fri Sep 19, 2008 2:26 pm

Re: mod_rewrite not working!

Post by wolphy »

could there be something missing from my {metadata} tag?  The tag is in the template, so I know that part's okay.
Ziggywigged
Power Poster
Power Poster
Posts: 424
Joined: Sat Feb 02, 2008 12:42 am
Location: USA

Re: mod_rewrite not working!

Post by Ziggywigged »

Try using the htaccess that come with the core download:

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>
Take a penny, leave a penny.
wolphy
Forum Members
Forum Members
Posts: 33
Joined: Fri Sep 19, 2008 2:26 pm

Re: mod_rewrite not working!

Post by wolphy »

I think that's what I originally started with.  Just tried it again and nope, that doesn't work either...
Ziggywigged
Power Poster
Power Poster
Posts: 424
Joined: Sat Feb 02, 2008 12:42 am
Location: USA

Re: mod_rewrite not working!

Post by Ziggywigged »

Are you by any chance using Dreamweaver to upload the .htaccess file? If so, try using a different FTP program.
Take a penny, leave a penny.
wolphy
Forum Members
Forum Members
Posts: 33
Joined: Fri Sep 19, 2008 2:26 pm

Re: mod_rewrite not working!

Post by wolphy »

Nope, not uploading with Dreamweaver.  I'm using CPanel to upload htaccess.txt, then renaming to .htaccess
wolphy
Forum Members
Forum Members
Posts: 33
Joined: Fri Sep 19, 2008 2:26 pm

Re: mod_rewrite not working!

Post by wolphy »

SOLVED!

okay,  hopefully NOBODY else suffers from the same kind of stupidity i've suffered from the last couple of days.

here's what happened:
i designed and wrote an entire site, THEN changed the config and htaccess files to implement pretty URLs and no matter what i did, i couldn't get it to work.  i fiddled endlessly with the code in the config and htaccess files, researched exhaustively, posted in forums, and just about gave up, thinking i had a quirky host or a nasty guardian angel.  the one thing i DIDN'T think of was that all the links in my html were written before the mod_rewrite rules so the hrefs were to php query strings.  oh man...... where's the "embarassed" emoticon?
Locked

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