pretty urls without the index.php?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Metal Beryl
Forum Members
Forum Members
Posts: 69
Joined: Wed Apr 18, 2007 9:57 am

pretty urls without the index.php?

Post by Metal Beryl »

Hello,

I have followed the guide to set up pretty urls and it has almost worked. How do I get rid of the index.php in the url http://localhost/cms/[b]index.php[/b]/blog/

.htaccess file

Code: Select all

  Options +FollowSymLinks
  RewriteEngine on
  RewriteBase /cms
 
  # 301 Redirect all requests that don't contain a dot or trailing slash to
  # include a trailing slash
  # except for form POSTS
  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]
config.php

Code: Select all

$config['url_rewriting'] = 'internal';

#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '/';

#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'] = '/';
Thanks
Jane
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: pretty urls without the index.php?

Post by Nullig »

Change:
    $config['url_rewriting'] = 'internal';
to:
    $config['url_rewriting'] = 'mod_rewrite';

Nullig
Metal Beryl
Forum Members
Forum Members
Posts: 69
Joined: Wed Apr 18, 2007 9:57 am

Re: pretty urls without the index.php?

Post by Metal Beryl »

Thanks Nullig,

If I do that I get 'The requested URL was not found on this server.' Error 404 when i navigate through the pages, only the home page (index) works. Any ideas why it would do that?

Thanks
Jane
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: pretty urls without the index.php?

Post by Dr.CSS »

Is this on your computer or on a server?...

I don't think pretty URLs work on a PC install, and I see no reason to use it on a PC install...
Metal Beryl
Forum Members
Forum Members
Posts: 69
Joined: Wed Apr 18, 2007 9:57 am

Re: pretty urls without the index.php?

Post by Metal Beryl »

I'm testing it out on both. My client wants easier urls to use on printed material and as the website is live I've been attempting to get it working on my localhost before risking in on the live website. I have got the url index.php/page working on the live website just cant get rid of the index.php part, tried all kinds.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: pretty urls without the index.php?

Post by Dr.CSS »

Take the htaccess.txt out of the doc folder in root and put in root, rename it to .htaccess, change config to...

$config['url_rewriting'] = 'mod_rewrite';  internal keeps the index.php

#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '.html'; or some other ext. / is not an extension

#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'; or leave blank
Post Reply

Return to “CMSMS Core”