简体   繁体   中英

cakePHP URL rewrite rule for static pages

I'm using cakePHP. How do I write a rewrite rule for the following condition.

http://www.example.com/pages/about_us

to

http://www.example.com/about

and similar to contact_us and other pages.

app/Config/routes.php

Router::connect('/about', array('controller' => 'pages', 'action' => 'display', 'about_us'));

您可以像这样使用 301 重定向:

Redirect 301 /about_us http://www.example.com/about

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