Page 1 of 1

pretty urls bring to 404

Posted: Sun Jun 24, 2007 9:42 pm
by izzysanime
Hi, i tried turning on pretty urls in config.php. 

if i make mod_rewirte true, i do get the wareriver.com/home/services/ , but all the pages lead to a 404 error

if i leave the following to false
#Show mod_rewrite URLs in the menu? You must enable 'use_hierarchy' for this to work for modules
$config['assume_mod_rewrite'] = false;

I get http://www.wareriver.com/index.php/services with index.php
I was hoping i could get it to http://www.wareriver.com/home/services

I like the part where i can add my own extension, like .josh ^_^

thanks,
Josh

Re: pretty urls bring to 404

Posted: Mon Jun 25, 2007 2:41 pm
by Pierre M.
Hello Josh,

I have tried your link and the first response is to be redirected without 'www' (while 404). To avoid "duplicate content" (which Google and I don't like) you should choose to enforce canonical hostname.

To your point now. You want pretty URLs. Good idea. What is wrong in the documentation ? It should work out of the box. I bet you don't have any .htaccess yet. There is a sample in the CMSms distribution package. Once you have a valid .htaccess, you can 'assume_mod_rewrite' to true.

Pierre M.

Re: pretty urls bring to 404

Posted: Tue Jun 26, 2007 3:02 am
by izzysanime
there is nothing wrong with the documentation, i could have sworn i searched and did not find anything, but thanks, ill read it.

thanks
Josh

Re: pretty urls bring to 404 .html at end of URL

Posted: Thu Jun 28, 2007 9:49 pm
by windsurfer
I too was getting a 404 error until I added .html to this line of code:
(See below in my config.php file)
#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '.html';



http://wiki.cmsmadesimple.org/index.php ... retty_URLs

BELOW ARE MY .HTACCESS AND CONFIG.PHP FILES THAT DID THE TRICK(FOR ME THAT IS)

.htaccess (MY COPY THAT WORKS!***copied elsewhere off this forum***)

DirectoryIndex index.html index.php
#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]

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

# Get memory up to 16M set here...


AND MY CONFIG.PHP FILE:

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

I hope this helps you!  It took care of my 404 error!

Aloha!

Jeff


Re: pretty urls bring to 404  .html at end of URL

Re: pretty urls bring to 404

Posted: Sun Sep 02, 2007 12:03 am
by WebGirl
Hi,

I've changed the settings in config.php to match Windsurfer's, as I want simple urls which are website.ext/pagename.html, as above
#------------
#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';
I was getting 404s, so I created a .htaccess file and put this exact text in it, from Windsurfer's post above:
DirectoryIndex index.html index.php
#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]

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

# Get memory up to 16M set here...
Instead of 404s, I'm now getting:
Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster.
Error 500
Been trying to solve this for 24 hours - tearing my hair out, can anyone help?

Thanks in advance!!

WebGirl

Re: pretty urls bring to 404 - SOLVED!

Posted: Sun Sep 02, 2007 12:33 am
by WebGirl
After much stress, I came across a note from Ted, which said that during installation we receive a file called htaccess.txt

All we have to do is upload this file, RENAME it .htaccess

and the problem is solved!

The contents of this file [dated 09/05/06] are as follows:
#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]
So if none of the other 'htaccess' codes have worked for you, try this one which comes with the CMSMS installation.

I'm soooooo happy!
Webgirl!

Re: pretty urls bring to 404

Posted: Sun Sep 02, 2007 1:39 pm
by Pierre M.
Pierre M. wrote: ...the documentation ? It should work out of the box. I bet you don't have any .htaccess yet. There is a sample in the CMSms distribution package.
Please, having pretty URLs is easy : follow the documentation and use the (official) packaged .htaccess.

Pierre M.