开发者

cakephp plugin to make URL SEO friendly

开发者 https://www.devze.com 2023-02-05 12:46 出处:网络
How do I make cakephp website URL SEO friendly? Is there a plugin available for开发者_开发知识库 cakephp 1.2.6First define what you mean by \"SEO friendly\".

How do I make cakephp website URL SEO friendly? Is there a plugin available for开发者_开发知识库 cakephp 1.2.6


First define what you mean by "SEO friendly".

Most likely this just means you want to add the name of your "object" to the URL, i.e. add a slug. You can do that without any plugin:

echo $html->link($record['Model']['name'], array(
    'controller' => 'foo',
    'action' => 'bar',
    $record['Model']['id'],
    Inflector::slug($record['Model']['name'])
));
// -> /foo/bar/42/the-name

If you require any more customized URLs, first specify what exactly you need, then use Routing to create these custom URLs.


it's the only way to do it wothut any trouble... but if you don't like id in the url, then you should take a title, remove all symbols, replace spaces with -, and write to the datebase...

0

精彩评论

暂无评论...
验证码 换一张
取 消