[FIXEDPretty URL's - So close, but still not quite working - 404 error on links!

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
evismaniac

[FIXEDPretty URL's - So close, but still not quite working - 404 error on links!

Post by evismaniac »

Hey folks!

Im trying to get the pretty URLs working on my site.

I'm pretty sure iv done everything correctly, and my links are showing correctly in my menu, but when they are clicked all I get is a 404 - Page not found error.

My config is as follows:

------------------------------------------------------------------------------------------------------------------------------
***.htaccess*** (Options +FollowSymLinks removed due to causing problems)
------------------------------------------------------------------------------------------------------------------------------

RewriteEngine on
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 [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+).php$ index.php?page=$1 [QSA]


------------------------------------------------------------------------------------------------------------------------------
***Config.php - URL***
------------------------------------------------------------------------------------------------------------------------------

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

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

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

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

------------------------------------------------------------------------------------------------------------------------------

I want the .php file extension, but I have tried it without and just the / but it still doesnt work. 

The internal pretty URLs does work, and everything works fine without any of this, in the default setup.

Any ideas what is wrong?  I have read lots of threads on here, but not found a definite solution that has worked for me!

Many thanks for any help!

p.s I have the in the source code ok!

It not anything to do with me having the website in a subfolder is it?  i have the htaccess file on the root of that folder, so in theory that folder is the pure root of the site!
Last edited by evismaniac on Mon Mar 19, 2007 5:35 pm, edited 1 time in total.
User avatar
moonie
Forum Members
Forum Members
Posts: 81
Joined: Tue Feb 13, 2007 3:08 pm

Re: Pretty URL's - So close, but still not quite working - 404 error on links!

Post by moonie »

Not entirely sure of this, but I think your

RewriteRule ^(.+).php$ index.php?page=$1 [QSA]

should be changed into

RewriteRule ^(.+)$ folderwhereyourcmsis/index.php?page=$1 [QSA]
evismaniac

Re: Pretty URL's - So close, but still not quite working - 404 error on links!

Post by evismaniac »

Worked a treat!  thanks a lot!

I must remember to reconfigure when i move it to its own hosting!

thanks again!
Post Reply

Return to “CMSMS Core”