mod_rewrite problem

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
miss_d_bus
Forum Members
Forum Members
Posts: 121
Joined: Sun May 01, 2005 4:27 pm

mod_rewrite problem

Post by miss_d_bus »

using the mod_rewrite, my files are now .php but I cant access the admin area any more. I get this error:

Warning: Smarty error: unable to read resource: "db:admin/index" in /usr/local/psa/home/vhosts/kentradiohire.co.uk/httpdocs/TEST/lib/smarty/Smarty.class.php on line 1088

Any ideas what might be wrong?

Thanks.
User avatar
sjg
Power Poster
Power Poster
Posts: 310
Joined: Thu Jan 27, 2005 5:11 pm

Re: mod_rewrite problem

Post by sjg »

Could you post your mod_rewrite rules, so we can see exactly what's being rewritten?
Many modules available from the http://dev.cmsmadesimple.org
The CMS Made Simple Developer Cookbook is now available from Packt Publishers!
miss_d_bus
Forum Members
Forum Members
Posts: 121
Joined: Sun May 01, 2005 4:27 pm

Re: mod_rewrite problem

Post by miss_d_bus »

Here it is for the .htaccess:

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 % !-f [NC]
RewriteRule ^(.+)\.php$ index.php?page=$1 [QSA]
For the config.php file:

Code: Select all

$config['page_extension'] = '.php';
I think thats all of it.
Thanks.
User avatar
sjg
Power Poster
Power Poster
Posts: 310
Joined: Thu Jan 27, 2005 5:11 pm

Re: mod_rewrite problem

Post by sjg »

Ah, OK. I understand what's going on. When you try to get into the admin, it's still doing the rewriting. The solution is to put another .htaccess file in your admin directory. That .htaccess file should look like:

Code: Select all

RewriteEngine Off
That should make it work.

Good luck!
___Samuel___
Many modules available from the http://dev.cmsmadesimple.org
The CMS Made Simple Developer Cookbook is now available from Packt Publishers!
miss_d_bus
Forum Members
Forum Members
Posts: 121
Joined: Sun May 01, 2005 4:27 pm

Re: mod_rewrite problem

Post by miss_d_bus »

Thank you!
yes that worked perfectly :D
Now CMSMS will do exactly what I need :)
miss_d_bus
Forum Members
Forum Members
Posts: 121
Joined: Sun May 01, 2005 4:27 pm

Re: mod_rewrite problem

Post by miss_d_bus »

Does this work any more ?
I cannot get it to work with the current version of this cms.

thanks,
Catherine
Pierre M.

Re: mod_rewrite problem

Post by Pierre M. »

What are you talking about ?
Front end URL rewriting OR back end URL not rewriting ?
Both are quite independant of the version of CMSms. You should not have any trouble.
Please describe your problem : CMSms version, URL rewriting options, config parameters...

PM
miss_d_bus
Forum Members
Forum Members
Posts: 121
Joined: Sun May 01, 2005 4:27 pm

Re: mod_rewrite problem

Post by miss_d_bus »

i have an existing website where the files are filename.php as the files are static.
I am converting the website over to the cms and want to retain the same file names so it is front end url rewriting i am after.
I am using the latest version of cms under apache and linux.

Since the config.php file no longer contains the parameter:
$config['page_extension'] = '.php';

I wondered if it was obsolete, and if so, what would i do to achieve what i require?


Thanks,
Catherine
Pierre M.

Re: mod_rewrite problem

Post by Pierre M. »

I don't think the page extension is obsolete. May be your new installation has a problem with its config.php. I think you should erase all cmsms.php and reinstall 1.0.2 from scratch. Or may be the php handler catches the request before the rewrite ?

According to http://wiki.cmsmadesimple.org/index.php ... l_Settings , once you have set up your .htaccess, you can achieve what you do with :
$config['assume_mod_rewrite'] = true;
$config['internal_pretty_urls'] = falsee;
$config['page_extension'] = '.php'; (your trick)
$config['use_hierarchy'] = true; (as you wish, this is my favorite)

I'm sure it is possible to make the ".php site" you describe by properly configuring the php handler, the rewrite and cmsms config. But I would not recommend that. I understand you want to keep your URLs, but may I suggest another (may be simpler) way to do it :
-build the new website with a nice long term URL scheme. I mean ".html" or ".xhtml" extensions.
-use the webserver mod_rewrite to send 301 (permanently moved) responses for any request to your existing ".php" URLs, redirecting properly search engines and users from /path/to/existing/page.php to /path/to/existing/page.html

PM
miss_d_bus
Forum Members
Forum Members
Posts: 121
Joined: Sun May 01, 2005 4:27 pm

Re: mod_rewrite problem

Post by miss_d_bus »

Thanks for that.
I think i got the config settings a bit wrong.
I'll try it when i get back to work


Thanks
Post Reply

Return to “CMSMS Core”