Friendly urls

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
DonnaNJ
Forum Members
Forum Members
Posts: 40
Joined: Mon Nov 19, 2007 6:08 pm

Friendly urls

Post by DonnaNJ »

We are using friendly urls on this site

http://www.omegawomenscenter.com/index.php/insurance

and it all seems to be working

However client doesn't like the index.php inbetween - he read somewhere that this is not good for the search engines and doesn't want it.

He wants  just /pagename - like we see on many other sites.

Is there a way to fix this ? Should I just put a redirect for each page into the .htaccess or something ?

Or is there another way to reconfigure this a config file  ?  OR ???

Thanks

DonnaNJ
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Friendly urls

Post by Rolf »

Hi DonnaNJ

If this website is on a Windows server, you have no other choice...

Is the site on a linux server, you can change this line in the config.php

Code: Select all

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

Code: Select all

$config['url_rewriting'] = 'mod_rewrite';
Regards, Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
DonnaNJ
Forum Members
Forum Members
Posts: 40
Joined: Mon Nov 19, 2007 6:08 pm

Re: Friendly urls

Post by DonnaNJ »

OK tried that- on  hover the url looks right -but clicking gives a page-not-found

So I added the following to  the  .htaccess (found in another post)

Options +FollowSymLinks
  RewriteEngine on
  RewriteBase /

  # 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 ^(.+).htm$ index.php?page=$1 [QSA]


Still-page-not-found error.

Site is live so I had to go back to pretty urls.

DonnaNJ
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Friendly urls

Post by Rolf »

Hi DonnaNJ

Your test shows that you are on a Windows server...
Windows doesn't do anything with the .htaccess file, thats why you get 404 errors.

You need to use Internal to get 'pretty' url.
And as far as I know this means you always get index.php in the url.

Regards, Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Friendly urls

Post by Nullig »

In your config.php file did you have the following set:

$config['page_extension'] = '.htm';

Nullig
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: Friendly urls

Post by Wishbone »

Rolf wrote: Your test shows that you are on a Windows server...
Windows doesn't do anything with the .htaccess file, thats why you get 404 errors.
If the Windows server is running Apache, it will read .htaccess files.
compufairy
Forum Members
Forum Members
Posts: 183
Joined: Sun Sep 07, 2008 10:47 am

Re: Friendly urls Windows server

Post by compufairy »

I had to install CMSMS on a Windows server. The hoster had a nice description (and the ONLY referral to CMS Made Simple in the FAQ) how to active pretty URL in CMS Made Simple on their server. I give it to you here, maybe this works for you too...

Change "URL Settings" in config as described below.

   #------------
   #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'] = '/';

   #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';



Then make a file in the www root called "httpd.ini". In this file you write:

   [ISAPI_Rewrite]

   RewriteRule /([^/]+)/ /index.php?page=$1 [I,L]
   RewriteCond Host: ^uwdomein.nl
   RewriteRule (.*) http://www.uwdomein.nl$1 [I,RP]


Hope this works for you. If it does, please put [SOLVED] in front of topic.
Regards,

Anne-Mieke
Last edited by compufairy on Mon Mar 22, 2010 11:48 am, edited 1 time in total.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur..." (Red Adair)
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Friendly urls

Post by Dr.CSS »

That looks like a very old config.php, mine look like this...

#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. htt***.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. htt***.mysite.com/index.php?page=somecontent)
$config['query_var'] = 'page';


Note: *** added to not make links... :)
Locked

Return to “[locked] Installation, Setup and Upgrade”