Hello,
I am trying to get my site to use pretty url. Below are my settings in the config.php file:
$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = '.html';
$config['use_hierarchy'] = false;
$config['query_var'] = '';
However the pages are still coming up as http://www.website.com/index.php?page=anotherpage
What am i doing wrong?
One of the installation manuals says to include a .htaccess file in the root of the website.
The full content of .htaccess file is:
# 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 ^(.+).htm$ index.php?page=$1 [QSA]
Obviously i have messed up somewhere.
Please help.
Thanks.
EDIT: please add [solved] to subject line when it is...
[solved] Pretty URL not working
[solved] Pretty URL not working
Last edited by Anonymous on Tue Dec 22, 2009 10:38 pm, edited 1 time in total.
Peace & Love
--------------------------------------------------------------------------
Useful stuff: {$entry->fields|@print_r}
web design london
--------------------------------------------------------------------------
Useful stuff: {$entry->fields|@print_r}
web design london
Re: Pretty URL not working
try using the default htaccess.txt that exists in the /docs folder, rename that to .htaccess in the root.
Ronny
Ronny
Re: Pretty URL not working
I did what you said however when i uploaded the .htaccess document to the root the website stops working and displays a "500 internal server error" message.
The contents of the htaccess file are:
-------------------------------------------
# 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]
---------------------------------------------------------------------------------------------
What do i need to edit in the file to get it working?
Do i need to make any changes to the config.php file or is it ok as shown above?
Am i right in assuming that the current url's will be updated or will i have to manually change them?
Thanks in advance.
The contents of the htaccess file are:
-------------------------------------------
# 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]
---------------------------------------------------------------------------------------------
What do i need to edit in the file to get it working?
Do i need to make any changes to the config.php file or is it ok as shown above?
Am i right in assuming that the current url's will be updated or will i have to manually change them?
Thanks in advance.
Peace & Love
--------------------------------------------------------------------------
Useful stuff: {$entry->fields|@print_r}
web design london
--------------------------------------------------------------------------
Useful stuff: {$entry->fields|@print_r}
web design london
-
- Power Poster
- Posts: 424
- Joined: Sat Feb 02, 2008 12:42 am
Re: Pretty URL not working
Try to put # before the line 'options +follow...'
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: Pretty URL not working
and you need to put 'page' back in the config.php, in the line 'query_var', otherwise the .htaccess file can't do its job.
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: Pretty URL not working
- To Ziggywigged: I am on a linux debian server -
Rolf:
I put # before the line as you said and that has fixed the "500 internal server error" message issue.
Will the pages update by themselves or do i have to do something to activate the pretty url's.
I have also cleared the cache.
I have changed the config.php file and it looks like this now:
#------------
#URL Settings
#------------
#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 ... ty_URL.27s
$config['url_rewriting'] = 'mod_rewrite';
#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '.html';
#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';
--------------------------------------------------------------------
The .htaccess file is as follows:
----------------
# 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]
It's still not working.
What am i doing wrong?
Rolf:
I put # before the line as you said and that has fixed the "500 internal server error" message issue.
Will the pages update by themselves or do i have to do something to activate the pretty url's.
I have also cleared the cache.
I have changed the config.php file and it looks like this now:
#------------
#URL Settings
#------------
#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 ... ty_URL.27s
$config['url_rewriting'] = 'mod_rewrite';
#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '.html';
#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';
--------------------------------------------------------------------
The .htaccess file is as follows:
----------------
# 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]
It's still not working.
What am i doing wrong?
Peace & Love
--------------------------------------------------------------------------
Useful stuff: {$entry->fields|@print_r}
web design london
--------------------------------------------------------------------------
Useful stuff: {$entry->fields|@print_r}
web design london
Re: Pretty URL not working
How did you create those links? Are they manually put there, or are the links created by the menumanager {menu} tag?pukka wrote: However the pages are still coming up as http://www.website.com/index.php?page=anotherpage
What am i doing wrong?
Last edited by Jos on Sat Dec 19, 2009 11:20 pm, edited 1 time in total.
Re: Pretty URL not working
should be okay now... do you have hardcoded url's on your site perhaps? got an url of the site?
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: Pretty URL not working
It works ok now.
Thanks a lot guys. Very much appreciated.
Thanks a lot guys. Very much appreciated.

Peace & Love
--------------------------------------------------------------------------
Useful stuff: {$entry->fields|@print_r}
web design london
--------------------------------------------------------------------------
Useful stuff: {$entry->fields|@print_r}
web design london