SOLVED - Pretty URLs and mod_rewrite = 404

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
mjcp
New Member
New Member
Posts: 2
Joined: Tue Jun 16, 2009 1:53 pm

SOLVED - Pretty URLs and mod_rewrite = 404

Post by mjcp »

I have a base installation of 1.6.6.  located in a sub folder www.domain.com/cms

I have set .httaccess as:

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

I have set config.php:

$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = '.html';
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';

I want to create URLs as: www.domain.com/cms/page_name.html

When I hover over a link I see the correct www.domain.com/cms/page_name.html
When I click a link I get an error 404

If I click the home icon, it works correctly and goes back to www.domain.com/cms

I have several earlier versions (1.5.4) of CMSMS running on the same host and Pretty URLs are working happily.

Any ideas?!?

Cheers,

Marc
Last edited by mjcp on Sat Nov 07, 2009 11:59 am, edited 1 time in total.
alby

Re: Pretty URLs and mod_rewrite = 404

Post by alby »

mjcp wrote: I have a base installation of 1.6.6.  located in a sub folder www.domain.com/cms

I have set .httaccess as:
Try with this .htaccess (source http://wiki.cmsmadesimple.org/index.php ... And_Tricks):
 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 ^(.+).htm$ index.php?page=$1 [QSA]
Alby
mjcp
New Member
New Member
Posts: 2
Joined: Tue Jun 16, 2009 1:53 pm

SOLVED - Re: Pretty URLs and mod_rewrite = 404

Post by mjcp »

Thanks,

I pasted your .htt version and changed .html to .htm in config.pho and it worked!  Have now changed both to .html and it's still going strong.

I think my errors were:

1.  In the RewriteBase I have /cms/  you had /cms  (no trailing / )
2.  You had RewriteRule ^(.+).htm$ index.php?page=$1 [QSA]
  I had RewriteRule ^(.+)(.html)?$ index.php?page=$1 [QSA]  (no "( )?"  around the .html  )

Many thanks!

Marc
Locked

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