Page 1 of 2

[SOLVED]Links in menu lead to 404 error message--page not found

Posted: Sun May 18, 2008 11:57 pm
by aspires
I am running on a local host (Apache 2.0, PHP5, MySQL5, CMS 1.2.4) creating a site for a friend. Everythign is going quite well. I thought I had everythign licked actually, forms and all but...

I have 3 pages to start.  Home, About, Order Form
Only Home can be seen, the default page. When I click in the menu on the home page on one of the other links (which appeat properly styled with backgorund images, etc.) I get a 404 error in IE, file not found.

I can preview the pages.

Please let me know if I can provide more info to help solve this.

Cheers
andrea

Re: Links in menu lead to 404 error message--page not found

Posted: Mon May 19, 2008 2:51 am
by Dr.CSS
Have you checked the config.php, what do the links in the menu point to?...

Re: Links in menu lead to 404 error message--page not found

Posted: Tue May 20, 2008 12:37 am
by aspires
Thank you for your reply.

This is what my menu looks like if I view the source. Is this what you meant?

Code: Select all

<ul>

<li class="currentpage"><h3><dfn>Current page is 1: </dfn>Home</h3>


</li>

<li><a href="http://localhost/cmsmadesimple/about-us.html"><dfn>2: </dfn>About Us</a>


</li>

<li><a href="http://localhost/cmsmadesimple/order_now.html"><dfn>3: </dfn>Order Now</a>


</li>
</ul>
Here is my config file below.

Code: Select all

<?php


#CMS Made Simple Configuration File
#Please clear the cache (Site Admin->Global Settings in the admin panel)
#after making any changes to path or url related options

#-----------------
#Database Settings
#-----------------

#This is your database connection information.  Name of the server,
#username, password and a database with proper permissions should
#all be setup before CMS Made Simple is installed.
$config['dbms'] = 'mysqli';
$config['db_hostname'] = 'localhost';
$config['db_username'] = 'root';
$config['db_password'] = 'rootword';
$config['db_name'] = 'cms';

#If app needs to coexist with other tables in the same db,
#put a prefix here.  e.g. "cms_"
$config['db_prefix'] = 'cms_';

#Use persistent connections?  They're generally faster, but not all hosts
#allow them.
$config['persistent_db_conn'] = false;

#Use ADODB Lite?  This should be true in almost all cases.  Note, slight
#tweaks might have to be made to date handling in a "regular" adodb
#install before it can be used.
$config['use_adodb_lite'] = true;

#-------------
#Path Settings
#-------------

#Document root as seen from the webserver.  No slash at the end
#If page is requested with https use https as root url
#e.g. http://blah.com
$config['root_url'] = 'http://localhost/cmsmadesimple';
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on')
{
$config['root_url'] = str_replace('http','https',$config['root_url']);
}

#Path to document root. This should be the directory this file is in.
#e.g. /var/www/localhost
$config['root_path'] = 'C:\Program Files\Apache Software Foundation\htdocs\cmsmadesimple';

#Name of the admin directory
$config['admin_dir'] = 'admin';

#Where do previews get stored temporarily?  It defaults to tmp/cache.
$config['previews_path'] = 'C:\Program Files\Apache Software Foundation\htdocs\cmsmadesimple\tmp\cache';

#Where are uploaded files put?  This defaults to uploads.
$config['uploads_path'] = 'C:\Program Files\Apache Software Foundation\htdocs\cmsmadesimple\uploads';

#Where is the url to this uploads directory?
$config['uploads_url'] = $config['root_url'] . '/uploads';


#---------------
#Upload Settings
#---------------

#Maxium upload size (in bytes)?
$config['max_upload_size'] = 1000000000;

#Permissions for uploaded files.  This only really needs changing if your
#host has a weird permissions scheme.
$config['default_upload_permission'] = '664';

#------------------
#Usability Settings
#------------------

#Allow smarty {php} tags?  These could be dangerous if you don't trust your users.
$config['use_smarty_php_tags'] = false;

#CMSMS Debug Mode?  Turn it on to get a better error when you
#see {nocache} errors.
$config['debug'] = false;

#Automatically assign alias based on page title?
$config['auto_alias_content'] = true;

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

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

#--------------
#Image Settings
#--------------

#Which program should be used for handling thumbnails in the image manager.
#See http://wiki.cmsmadesimple.org/index.php/User_Handbook/Admin_Panel/Content/Image_Manager for more
#info on what this all means
$config['image_manipulation_prog'] = 'GD';
$config['image_transform_lib_path'] = '/usr/bin/ImageMagick/';

#Default path and URL for uploaded images in the image manager
$config['image_uploads_path'] = 'C:\Program Files\Apache Software Foundation\htdocs\cmsmadesimple\uploads\images';
$config['image_uploads_url'] = $config['root_url'] . '/uploads/images'; 


#------------------------
#Locale/Encoding Settings
#------------------------

#Locale to use for various default date handling functions, etc.  Leaving
#this blank will use the server's default.  This might not be good if the
#site is hosted in a different country than it's intended audience.
$config['locale'] = '';

#In almost all cases, default_encoding should be empty (which defaults to utf-8)
#and admin_encoding should be utf-8.  If you'd like this to be different, change
#both.  Keep in mind, however, that the admin interface translations are all in
#utf-8, and will be converted on the fly to match the admin_encoding.  This
#could seriously slow down the admin interfaces for users.
$config['default_encoding'] = '';
$config['admin_encoding'] = 'utf-8';

#---------------------------------------------
#Use the old stylesheet logic?  It's much slower, but it works with older
#versions of CMSMS.  You'll also need this set to true if there is a module
#that uses a stylesheet callback.  Leave it as false instead you really
#need it.
$config['old_stylesheet'] = false;

# URL of the Admin Panel section of the User Handbook
$config['wiki_url'] = 'http://wiki.cmsmadesimple.org/index.php/User_Handbook/Admin_Panel';

#Enable backwards compatibility mode?  This basically will allow some
#modules written before 1.0 was released to work.  Keep in mind that this
#will use a lot more memory and isn't guaranteed to fix the problem.
$config['backwards_compatible'] = false;

#Not used anymore... kept around, just in case
$config['disable_htmlarea_translation'] = false;
$config['use_Indite'] = true;
?>

Re: Links in menu lead to 404 error message--page not found

Posted: Tue May 20, 2008 12:51 am
by aspires
This is the part of my apache config file that I thought I needed to adjust. Since I am running a few differnet projects off this server my root is just htdocs (I aslo have a ZenCart set up and some other sites). I adjusted it according to the documenation under "Tips and Tricks". Was I wrong to do so? It didn't seem to help.
Cheers
Andrea

Code: Select all

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/Program Files/Apache Software Foundation/htdocs"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories). 
#
# First, we configure the "default" to be a very restrictive set of 
# features.  
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Satisfy all
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/Program Files/Apache Software Foundation/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options -Indexes +FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    #AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
#
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
</FilesMatch>

Re: Links in menu lead to 404 error message--page not found

Posted: Tue May 20, 2008 6:09 pm
by Pierre M.
No .htaccess ?

Re: Links in menu lead to 404 error message--page not found

Posted: Tue May 20, 2008 6:58 pm
by aspires
Umm. Sorry. You want me to put up my .htaccess file? I can do that.

Cheers
Andrea

Re: Links in menu lead to 404 error message--page not found

Posted: Wed May 21, 2008 12:07 am
by aspires
I don't really understand the htaccess file. What it does or where it is supposed to be. Should it be in the root directory?

Code: Select all

#php_flag magic_quotes_gpc Off

#php_flag register_globals Off

#php_flag session.use_trans_sid Off


# Make sure you have Options FollowSymLinks

# and Allow on
RewriteEngine On


#Rewrites page.shtml as index.php?page
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
Cheers
Andrea

Re: Links in menu lead to 404 error message--page not found

Posted: Wed May 21, 2008 12:52 am
by aspires
There is definitely something messed up. Directory looks like this:
Apache/htdocs/cmsms/...and this should be where everything resides.

But htdocs is my root directory in all my config files of Apache since I also have a zen cart installation in there that I have just started working on. So I want that to work when I get to it as well.

When I click on my links in the menu to other pages they have html extensions (ie /about_us.html)and the home page is index.php. So maybe something wrong with pretty urls? Which I didn't think I had activated yet actually.

I would really appreciate some help with this one. I have all these configuration files (php, apache, htaccess) that I barely understand and I think I made a big mistake (or perhaps just a small mistake) somewhere in there.

Cheers
Andrea ;D

Re: Links in menu lead to 404 error message--page not found

Posted: Wed May 21, 2008 4:36 pm
by Pierre M.
Is the .htaccess in the /cmsms/ folder ?

Re: Links in menu lead to 404 error message--page not found

Posted: Wed May 21, 2008 7:16 pm
by Dr.CSS
Do you have anything in the cmsmsmadesimple folder besides the CMSMS folder/files?...

Have you tried turning the pretty URL settings off in the config.php?...

Re: Links in menu lead to 404 error message--page not found

Posted: Thu May 22, 2008 12:59 am
by aspires
There is nothing else in the cmsms folder and that is where the .htaccess file is saved.

Do I need to change anything in the htaccess file? Does the # (number sign) mean anything in that file(like it does in the config files)?

When you say config.php is that the cmsms config file? If so here is that section: (I guess I had mod_rewrite enabled but perhaps there is something I am missing or I shoudl just use internal pretty urls instead?)

Code: Select all

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

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

Re: Links in menu lead to 404 error message--page not found

Posted: Thu May 22, 2008 1:03 am
by Dr.CSS
I would set the config back to default...

1) false
2) ''
3) false
4) page

See how that works...

Re: Links in menu lead to 404 error message--page not found

Posted: Thu May 22, 2008 1:15 am
by aspires
Yes, that solved it! So I did something else wrong when I was configuring for mod_rewrite!

I wish I knew what I had done wrong. I woudl liek to have pretty urls but I will have to move this to a live server next week so perhaps I will try to trouble shoot then. Thank you very much Mark.

Andrea

Re: [SOLVED]Links in menu lead to 404 error message--page not found

Posted: Thu Jul 17, 2008 2:08 am
by complete
I was having the same "file not found" error; then I tried resetting the config.php back to defaults as suggested.  It worked.

I troubleshooted the issue a bit more and found that I could keep all my modded settings except for the "use_hierarchy" setting.  When I set it to true, the problem occurred.  When I set it to false, the problem was gone.

Not sure how to proceed.  Any help would be appreciated.

Thanks,
Mike

Re: [SOLVED]Links in menu lead to 404 error message--page not found

Posted: Thu Jul 17, 2008 3:10 am
by viebig
please, upgrade to 1.3.1