Pretty URLS problem
Pretty URLS problem
Hi guys,
First time I've used CMSMS and it seems great so far, so less bloated than WP or Joomla!
Anyway, the installation all went just fine and I've managed to get my templates and content sorted no problem atall.
I'm now trying to get pretty urls setup and have been checking other topics in the forum here before I posted this, tried to get these solutions to work and it doesn't and to be honest I just don't quite get it. I'm a noob with mod rewrites and stuff like this so please excuse me if i've missed something really obvious!
At the moment whenever I try the URL using pretty mysite.com/page2.html it turns up a 404.
My config.php looks like this...
$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = '.html';
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';
And my .htaccess looks like this...(carbon copy of the sample one)
# 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
#
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
# 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]
Also I checked for mod_rewrite being turned on using the php info command I saw in another topic and it is listed under modules installed.
Any help is much appreciated...
First time I've used CMSMS and it seems great so far, so less bloated than WP or Joomla!
Anyway, the installation all went just fine and I've managed to get my templates and content sorted no problem atall.
I'm now trying to get pretty urls setup and have been checking other topics in the forum here before I posted this, tried to get these solutions to work and it doesn't and to be honest I just don't quite get it. I'm a noob with mod rewrites and stuff like this so please excuse me if i've missed something really obvious!
At the moment whenever I try the URL using pretty mysite.com/page2.html it turns up a 404.
My config.php looks like this...
$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = '.html';
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';
And my .htaccess looks like this...(carbon copy of the sample one)
# 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
#
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
# 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]
Also I checked for mod_rewrite being turned on using the php info command I saw in another topic and it is listed under modules installed.
Any help is much appreciated...
Re: Pretty URLS problem
Change your rewrite rule from:
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
to:
RewriteRule ^(.+).html$ index.php?page=$1 [QSA]
Nullig
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
to:
RewriteRule ^(.+).html$ index.php?page=$1 [QSA]
Nullig
Re: Pretty URLS problem
Nullig, is this documented? (He said it was a carbon copy of sample htaccess)Nullig wrote: Change your rewrite rule from:
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
to:
RewriteRule ^(.+).html$ index.php?page=$1 [QSA]
Nullig
Re: Pretty URLS problem
Hi,WebEd wrote: At the moment whenever I try the URL using pretty mysite.com/page2.html it turns up a 404.
Do you have the {metadata} tag in the head of your template?
Regards, Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: Pretty URLS problem
Hi guys,
Many thanks for the speedy responses.
I've tried changing the htaccess to what was suggested but it doens't change anything.
Rolf,
I didn't have the {metadata} tag in my template before but put it in now, unfortunatley nothing has changed it still returns a 404 error if I try to go to page2.html and not index.php?page=page2.
I think it might be best if I post a link to the site so you can see it in a little bit more detail, it's just a five page site so it's not huge. It's also not hosted yet, hence the url is http://66.7.221.78/~websitee/OMAS/index.php
Again, any help is much appreciated...
Many thanks for the speedy responses.
I've tried changing the htaccess to what was suggested but it doens't change anything.
Rolf,
I didn't have the {metadata} tag in my template before but put it in now, unfortunatley nothing has changed it still returns a 404 error if I try to go to page2.html and not index.php?page=page2.
I think it might be best if I post a link to the site so you can see it in a little bit more detail, it's just a five page site so it's not huge. It's also not hosted yet, hence the url is http://66.7.221.78/~websitee/OMAS/index.php
Again, any help is much appreciated...
Re: Pretty URLS problem
Perhaps your site is on a Windows server...
Try: $config['url_rewriting'] = 'internal';
®
Try: $config['url_rewriting'] = 'internal';
®
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: Pretty URLS problem
Thanks for the advice but that didn't work either.
I don't really understand how this is so difficult
I've followed the documentation to a tee but it just doens't seem to be working atall.
I don't really understand how this is so difficult

I've followed the documentation to a tee but it just doens't seem to be working atall.
Re: Pretty URLS problem
What is the:
$config['root_url'] =
set to in your config.php?
And does your server have mod_rewrite enabled?
Nullig
$config['root_url'] =
set to in your config.php?
And does your server have mod_rewrite enabled?
Nullig
Last edited by Nullig on Wed Feb 10, 2010 7:59 pm, edited 1 time in total.
Re: Pretty URLS problem
Hi Nullig,
The path is set to http://66.7.221.78/~websitee/OMAS
and as far as I am aware it had mod_rewrite enabled, it was listed under modules when I ran a php info command...
Thanks for your help
The path is set to http://66.7.221.78/~websitee/OMAS
and as far as I am aware it had mod_rewrite enabled, it was listed under modules when I ran a php info command...
Thanks for your help
Re: Pretty URLS problem
Are there any other .htaccess files further up the path:
http://66.7.221.78/~websitee/
http://66.7.221.78/
Do you have a domain name?
Nullig
http://66.7.221.78/~websitee/
http://66.7.221.78/
Do you have a domain name?
Nullig
Re: Pretty URLS problem
Hi Nullig,
The hosting actually houses about eight other websites, some using Wordpress, some are just simple html/php sites.
Each folder is setup as a seperate domain and therefor it has its own htaccess, however this doesn't affect any of the other folders settings, e.g the WP htaccess in a folder doesn't affect a different folders access settings.
I don't think this would be the problem.
Regarding the domain, I'm in the process of getting the domain transferred to my domain registrar (could take a couple days), what I will do when this is done is set it up with the domain attached so it will become www.kungfuclub.co.uk/index.html
and not 123.4.567.89/user/OMAS/index.html
Do you think this might be what the problem is?
The hosting actually houses about eight other websites, some using Wordpress, some are just simple html/php sites.
Each folder is setup as a seperate domain and therefor it has its own htaccess, however this doesn't affect any of the other folders settings, e.g the WP htaccess in a folder doesn't affect a different folders access settings.
I don't think this would be the problem.
Regarding the domain, I'm in the process of getting the domain transferred to my domain registrar (could take a couple days), what I will do when this is done is set it up with the domain attached so it will become www.kungfuclub.co.uk/index.html
and not 123.4.567.89/user/OMAS/index.html
Do you think this might be what the problem is?
Re: Pretty URLS problem
Hi,WebEd wrote: ...
and as far as I am aware it had mod_rewrite enabled, it was listed under modules when I ran a php info command...
...
In case it might help, I'll mention a quick and easy technique that I came up with to test if mod_rewrite and .htaccess are working as expected. I simply add a force-redirect rule to .htacces that will return a typically unused HTTP status code when someone tries to GET a "special" URI from the site.
The specific steps are:
1) Temporarily add the following two lines to the .htaccess file, after the "RewriteEngine On" but before any other RewriteCond or RewriteRules:
Code: Select all
ErrorDocument 418 "<h1>Yes, mod_rewrite is working!</h1>"
RewriteRule is.mod_rewrite.working$ - [R=418,L]
http:example.com/~whatever/is.mod_rewrite.working
3) If the error page displayed by the browser contains "Yes, mod_rewrite is working!", then... there's a good chance that mod_rewrite *is* working.


4) Remove the two lines, added in step 1), when done testing.
Hope this helps,
Fred P.
Nearly all men can stand adversity, but if you want to test a man's character, give him power.
- Abraham Lincoln
- Abraham Lincoln
Re: Pretty URLS problem
Your best bet is to wait to turn on pretty URLs till it has a real domain not something with ~ in it, you will find it easier and most likely it will work out of the box...
Re: Pretty URLS problem
Hi,
I've never tried this with an IP address, but...
In the past, I've successfully installed CMSMS on shared hosting using their "temporary" address (e.g., host9999.example.com/~username) while waiting for some DNS issues to be resolved. IIRC, all I had to do was change one line in the .htaccess file(s). For example, try changing:
RewriteBase /
to
RewriteBase /~websitee/
Once the DNS issues were resolved, and the root_url was updated to the real domain in config.php, I simply switched the RewriteBase line(s) back.
Hope this helps,
Fred P.
Nearly all men can stand adversity, but if you want to test a man's character, give him power.
- Abraham Lincoln
- Abraham Lincoln