我有生成站点地图的控制器action/posts/sitemap。现在我想把http//yoursite.com/sitemap.xml
指向/posts/sitemap/
有什么办法可以更改routes.php
来解决这个问题吗。
我感谢你的帮助。
您可以使用apaches重写引擎。将此添加到您的.htaccess
RewriteEngine on
RewriteRule ^sitemap.xml$ /posts/sitemap/
编辑
好吧,经过你的编辑,我必须承认,我的答案并不真正属于你的问题。我对蛋糕没有太多经验,但也许把它添加到你的routes.php
中会有所帮助:
Router::parseExtensions('xml');
Router::connect('/sitemap', array('controller' => 'posts', 'action' => 'sitemap'));