clean urls problem and solution - mod_rewrite

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
wesyah234
Forum Members
Forum Members
Posts: 60
Joined: Tue Mar 07, 2006 4:30 am

clean urls problem and solution - mod_rewrite

Post by wesyah234 »

I followed a forum post (can't remember where it was) that instructed me to copy the htaccess.txt from the doc directory to the root directory of cmsms, then to turn on the "assume clean urls" flag in the config file.

I did these 2 things, but couldn't get it to work.

After making sure mod_rewrite was working on my server, I started looking at the rewrite rules.

Seems that the version in the doc directory has this:

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

however the "assume clean urls" creates urls for the menu items without the .html extension, so going to the homepage of the site, then trying to navigate using the menus fails to work.

I added .html to the url and it worked.

Then modified the rewrite rule to drop the .html extension:
RewriteRule ^(.+)$ index.php?page=$1 [QSA]

and it worked completely.

Maybe I'm missing something, but if I'm not missing something, then the example htaccess.txt in the doc directory should be fixed to not use the .html extension in the rule.

Thanks!
Wes
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: clean urls problem and solution - mod_rewrite

Post by Ted »

What version is this?  I believe I introduced this inconsistency in 0.13 beta2, but I didn't think it was an issue on 0.12.1.
wesyah234
Forum Members
Forum Members
Posts: 60
Joined: Tue Mar 07, 2006 4:30 am

Re: clean urls problem and solution - mod_rewrite

Post by wesyah234 »

sorry, forgot to mention the version... it was indeed 13 beta 2

btw, it wouldn't be a bad thing to have the .html extension, the menuing system just needs to match the rewrite rule.

Perhaps a configurable "assume mod rewrite" that would either do the .html extension, or not do it...

Thanks
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: clean urls problem and solution - mod_rewrite

Post by Ted »

Yeah, we're going to modify it a little bit.  You won't have to touch the htaccess file anymore.  I think by default we're going to not have an extension and then you can just change it in one spot to use .html or whatever.
wesyah234
Forum Members
Forum Members
Posts: 60
Joined: Tue Mar 07, 2006 4:30 am

Re: clean urls problem and solution - mod_rewrite

Post by wesyah234 »

Great... looking forward to the next release!
Post Reply

Return to “CMSMS Core”