简体   繁体   中英

Cakephp change URL behaviour

We are developing a site using CakePHP. We have a windows IIS server (shared hosting) with PHP5, that does not support .htaccess or mod_rewrite but still we have the site up and running and developed a lot of things.

The current URL structure is something like this: mydomain/index.php/user/add

We want to change this to something like: mydomain/index.php?controller=user&action=add

We want to do this as we are facing some unexpected session expired problems and we doubt that it is due to the user travelling from one url to another like this: mydomain/index.php/user/add to mydomain/index.php/list/edit this change the domain for IIS or PHP which cause the session to expire, but cake is interpreting the pages perfectly.

If there is a way to change the behiviour of Cake to take the URL's with question and amphersand, it will be great.

Thanks in advance.

You may want to try something like this:

1) point your IIS document root to app/webroot 2) Call your application by going to http://site.com/index.php?url=/user/add

As for changing it into controller=user&action=add, the only thing I can suggest is to add code to your index.php file to translate the "controller=user&action=add" format to the url=/user/add format. You may want to also check the Router to see if there are functions you can use to change these things around.

If you need more help, I'd post the question in irc.freenode.net #cakephp

session expiring is not caused by the url structure. have you check?

  1. Configure::write('Session.timeout', '3600'); in core.php. make it longer
  2. Configure::write('Security.level', 'high'); in core.php. make it medium or low
  3. Configure::write('Session.checkAgent', false); in core.php make it false. can cause problem with ajax calls

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM