Page 1 of 1

[solved] Pretty URL Problem

Posted: Sat Feb 13, 2010 3:42 pm
by Joman
Hi Guys,

Unfortunately I also have a problem getting pretty URL´s set up! I am sure its just a small problem... I am using version 1.6.1 (german)

I did not create a .htaccess file since this caused a 500 internal server error using this:
# 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 /test/

#
# 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]

My config looks like this:
$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = '.html';
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';

So far I am using the standard Template. I added the {metadata} here:
.
.
.
.

{metadata}
 
   
     
{* start accessibility skip links *}
       
         {anchor anchor='menu_vert' title='Skip to navigation' accesskey='n' text='Skip to navigation'}
         {anchor anchor='main' title='Skip to content' accesskey='s' text='Skip to content'}
       
{* end accessibility skip links *}
       
{* Horizontal ruler that is hidden for visual browsers by CSS *}

{* Start Header, with logo image that links to the default start page *}
       
{* logo image that links to the default start page. Logo image is changed in the style sheet  "Layout: NCleanBlue" *}
         
           {cms_selflink dir="start" text="$sitename"}
         
.
.
.
.
.
Summary:

The .htaccess causes a 500 internal error
the edited config causes a http 404...

:(

I hope you guys can help!

EDIT: when it is solved put [solved] in subject line...

Re: Pretty URL Problem

Posted: Sat Feb 13, 2010 6:12 pm
by Dr.CSS
1) You are using an older version, support only goes 2 versions back, at this point that is 1.6.5 and 1.6.6 so upgrade ASAP...

2) You have config.php set to mod_rewrite so you "have" to use the .htaccess, it's best to start with the one in root/doc folder, it's named htaccess.txt, rename it .htaccess when you move it to root...

3) If you have the install in a subfolder like root/test the RewriteBase /  needs to be RewriteBase /test  w/o the / on the end...

4) All the default template have a {metadata} tag in them where it should be up in the not below the ...

5) Last but not least you have to make sure your host allows .htaccess...

One of the reasons we ask for so much information is to help us provide a better answer to the questions asked in the forum, for instance it may turn out that you are using an IIS/windows server and most of what I said wont work on a windows server, so please go to the start of the forum and read the README FIRST post...

Re: Pretty URL Problem

Posted: Sun Feb 14, 2010 11:35 am
by Joman
Thanks for the Answer Dr.CSS

I solved the Problem though. Even though I used the standard .htaccess it did not work, so I put a # in front of Options +FollowSymLinks

Here my .htaccess that works for me!
# 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
#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]