Page 1 of 1
Pretty urls not working with Hostgator
Posted: Sat Oct 04, 2008 12:07 pm
by nmorgan
Hello, I've installed CMSCS 1.4.1 on PHP 5.2.6, Mysql version 5.0.51a-community on Linux in shared hosting w/ Hostgator (I'm a reseller and this site in one of my sites on the reseller account)
Can't get pretty URLS to work using mod_rewrite.
I've done the basic .htaccess and config called for in the optional settings link:
http://wiki.cmsmadesimple.org/index.php ... l_Settings
Tried both settings internal urls and mod_rewrite. Neither worked. Tried all different settings mentioned in the forum - no luck. So I'm thinking maybe it's my host. I've called them. They said that AllowOverride All is an .htaccess setting but when I try it it doesn't work. My googling came up a very complicated document stating that AllowOveride All is an Apache server settings.
http://www.commentcamarche.net/forum/af ... -de-config
I've done the basic .htaccess and config called for in the optional settings link:
http://wiki.cmsmadesimple.org/index.php ... l_Settings
Here's the config.php
Here's the .htaccess:
# 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
#
Options -Indexes
ServerSignature Off
Options +FollowSymLinks
#
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]
Also, I copied the contents of doc/htaccess.txt and made a new .htacess and pasted it within the File Mgr. at my host to avoid FTP problems with Dreamweaver or other FTP.
I tried the .htaccess with AllowOver All removed added directly under Options +FollowSymLinks but that didn't work.
http://www.5countyhs.com/index.php?page ... hyompleted the site.
I've called my host twice and will call again. Did I miss anything or is it the host?
Re: Pretty urls not working with Hostgator
Posted: Mon Oct 06, 2008 5:02 pm
by Pierre M.
nmorgan wrote:
#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '.html';
# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
This seems incompatible to me : the URL suffix being both '.html' and '/'. I'm not sure you are using the provided htaccess sample from the official package.
Pierre M.
Pretty urls not working with Hostgator
Posted: Thu Oct 09, 2008 4:34 am
by nmorgan
Hello Pierre,
Thanks for your response. I've been meaning to login concerning the fact that things are working even before I got your post. I'm not actually sure what your post meant.
But here is what solved it.
Hostgator said they changed my config to read true on internal URLs (even though the docs don't say to do that). I think I saw it that way on the boards. And I thought I had tried everything.
Another issue I was having is that what I thought was on server (I use Dreamweaver) was not actually changing). Very, very weird to me, maybe permissions? But I wasn't getting an error -- just the inconsistency of what Dreamweaver was telling me was in those files and what my host file manager showed.
.htacess
# 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
#
Options -Indexes
ServerSignature Off
Options +FollowSymLinks
#
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]
config
#------------
#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'] = 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';
So if things are working should I not change anything? I hate to mess with it. I thought for sure I grabbed that .htaccess from where the install page said to -- the doc folder. Maybe Hostgator added something to the file.
Thanks, this CMS is so very awesome! -- Nancy
Re: Pretty urls not working with Hostgator
Posted: Thu Oct 09, 2008 8:05 am
by Nick Smart
You can't have this:
nmorgan wrote:
$config['assume_mod_rewrite'] = true;
and this:
nmorgan wrote:
$config['internal_pretty_urls'] = true;
Set:
$config['internal_pretty_urls'] = false;
If you are using mod_rewrite and an htaccess file.
Nick
Re: Pretty urls not working with Hostgator
Posted: Thu Oct 09, 2008 8:13 am
by Nick Smart
... and you probably want:
Also, I'm not sure about all you dots and trailing slash stuff. You've got an 'L' rule on the rewrite which means 'Last' and so it won't process your actual rules that rewrite "mysite.com/index.php?page=about" to "mysite.com/about.html" AFAIK. I would just delete this section:
Code: Select all
# 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]
Nick
Re: Pretty urls not working with Hostgator
Posted: Fri Oct 10, 2008 1:00 am
by nmorgan
Pierre -- I did grab that htaccess file from the install/docs folder
Nick — I made the changes you suggested except deleting those last few rewrite lines you mentioned. If things are working should I leave that alone or should I do it anyway?
Now I have no idea why things are working because I had tried the current settings (the one's you recommended Nick -- except the last note about taking out the code in rewrites) what seemed like a million times before but now it is working. I wish I understood!
Thanks for helping me. I'm so proud to have come so far. I've been testing CMSs so long and I can't explain to my family and friends how important it is to have found such a great solution! I finally found one I can somewhat wrap my head around.
Re: Pretty urls not working with Hostgator
Posted: Fri Oct 10, 2008 11:14 am
by Nick Smart
If it works, and you are happy with how the urls are presented, then leave them there - "if it ain't broke, don't fix it"
Nick
Re: Pretty urls not working with Hostgator
Posted: Fri Oct 10, 2008 4:12 pm
by Pierre M.
Hello again,
nmorgan wrote:
Pierre -- I did grab that htaccess file from the install/docs folder
You are right, I've just checked : the provided htaccess sample is no more the out-of-the-box working one that was packaged before. The now-official htaccess sample has the trailing slashes pollution

May be the beginning of some support pain.
Pierre M.
Re: Pretty urls not working with Hostgator
Posted: Sun Jan 18, 2009 2:50 am
by Riavon
I have the
exact situation as nmorgan, to the letter.
The only way I can get pretty urls is by using the "internal method" in the config file:
Code: Select all
#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'] = '';
[b]#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;[/b]
#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';
...but I still do not like the
mydomain.com/index.php/pagename
in front of the pagename, and would prefer to get the
really pretty urls one gets from the mod_rewrite method, that would give me
mydomain.com/pagename
. Should I delete the "trailing slash pollution" from my htaccess file in order to have the mod_rewrite method work?
Like nmorgan, I too have used the htaccess file included with the install, which is:
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>
Thanks in advance for any help.
Re: Pretty urls not working with Hostgator
Posted: Wed Jan 21, 2009 9:26 pm
by Pierre M.
Hello,
Riavon wrote:
I have the exact situation as nmorgan, to the letter.
No, see :
Riavon wrote:
#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '';
He wants a '.html' suffix to his URLs.
This trailing slash suffix IS a support pain

The /doc/htaccess.txt is not the old simple one. See the 1.2 one, or so, may be.
See
http://wiki.cmsmadesimple.org/index.php ... l_Settings
BTW I agree with Nick.
Pierre
Re: Pretty urls not working with Hostgator
Posted: Wed Jan 21, 2009 9:32 pm
by Riavon
nmorgan posted:
Hello, I've installed CMSCS 1.4.1 on PHP 5.2.6, Mysql version 5.0.51a-community
on Linux in shared hosting w/ Hostgator (I'm a reseller and this site in one of my sites on the reseller account)
Can't get pretty URLS to work using mod_rewrite.
I've done the basic .htaccess and config called for in the optional settings link:
http://wiki.cmsmadesimple.org/index.php ... l_Settings
Tried both settings internal urls and mod_rewrite. Neither worked. Tried all different settings mentioned in the forum - no luck. So I'm thinking maybe it's my host. I've called them. They said that AllowOverride All is an .htaccess setting but when I try it it doesn't work. My googling came up a very complicated document stating that AllowOveride All is an Apache server settings.
http://www.commentcamarche.net/forum/af ... -de-config
I've done the basic .htaccess and config called for in the optional settings link:
http://wiki.cmsmadesimple.org/index.php ... l_Settings
And yes, I
do indeed have that/those exact issue(s). Or rather, did. I've already built the website using good old fashioned HTML, CSS, and javascript, just like the good ole days. In less time than it takes to figure out how to hack and fix all the code to make CMS work, I can build and launch an entire website (And a dang good one, to boot!), collect the check and move on the the next one.
Thanks anyway. Toodles!