Search code examples
cakephpurl-masking

Cakephp URL masking?


For example: I have a controller: "Services" and an action called "web". Thus, my url would be:

http://www.domain.com/services/web/

How do I mask the url, such that if I type:

http://www.domain.com/servicesweb

will display exactly as http://www.domain.com/services/web/

I am reading the htaccess, not sure if its a correct solution to this.


Solution

  • It appears you missed the entire chapter in the CakePHP docs about Routing, which is this 'url masking' you speak of.

    In your /app/config/routes.php file you will need to add this line:

    Router::connect('/servicesweb',  array('controller' => 'services', 'action' => 'web'));
    

    Be sure to read the book for clarification on routing.