If you are like me and are creating personal web sites, one of the best ways to gain traffic to your site is through SEO. I won’t go into detail here as I want to focus on how to setup a route in CakePHP, but having SEO friendly URLs will go a long way in helping.
First let’s define what a “route” is. In CakePHP it allows you to add a different path to access a specific controller and/or function in that controller.
For example, let’s say I want to create a CMS. I might create a controller called “StaticContent” and then place a function for each page a client would like to create. I’m pretty sure I would start getting a lot of calls saying, “Jamie, why is my URL http://www.myaddress.com/StaticContent/myCustomPage?” So to avoid those calls, we can use a route to make it more accessible and SEO friendly.
To create our route it’s quite simple, open up app/config/routes.php in your editor of choice. To create a route for our static content, we would create something like this (you will need to update the names accordingly for your purpose):
Router::connect(‘/seo-friendly-url’, array(‘controller’ => ‘StaticContent’, ‘action’ => ‘unSeoFriendlyURL’));
The syntax above is saying, if we find the URL “/seo-friendly-url”, CakePHP should look for the content in the StaticContent controller and our unSeoFriendlyURL function.
The above example is a great way of how you can quickly create SEO friendly URLs and continue to create controllers and functions as you normally would.
Hopefully you have enjoyed today’s article, I am going to try and continue to create some more short and useful CakePHP examples.
Pingback: skin tag removal products
Pingback: warlock pvp guide
Pingback: top rc zone
Pingback: gold secrets guide
Pingback: computer help online
Pingback: Goozle Zone
Pingback: Ania Antonette Quisumbing
Pingback: bad credit loans
Pingback: guayabera history
Pingback: buy and download songs
Pingback: ultimate power profits
Pingback: zig zaga
Pingback: Motorbike Accident Claim Solicitors
Pingback: Personal Injury Solicitors in Manchester
Pingback: promo product
Pingback: ZigZag
Pingback: calaguas tour
Pingback: ZCode System Review