mavimo/ sculpin-redirect-bundle
Sculpin 重定向 Bundle
dev-master
2014-01-04 14:40 UTC
Requires
- php: >=5.3.2
This package is auto-updated.
Last update: 2024-09-14 08:45:46 UTC
README
设置
将此 bundle 添加到您的 sculpin.json
文件中
{ // ... "require": { // ... "mavimo/sculpin-redirect-bundle": "@dev" } }
并运行 sculpin update
来安装此 bundle。
现在您可以在 app/SculpinKernel.php
文件中找到的 SculpinKernel
类中注册此 bundle
class SculpinKernel extends \Sculpin\Bundle\SculpinBundle\HttpKernel\AbstractKernel { protected function getAdditionalSculpinBundles() { return array( 'Mavimo\Sculpin\Bundle\RedirectBundle\SculpinRedirectBundle' ); } }
如何使用
在您导入的内容中,您可以使用以下方式设置重定向项
redirect:
- alias-path.html
- old-path.html
然后在您的主题中创建一个包含以下内容的 redirect.html
文件
<!DOCTYPE html> {% spaceless %} <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="refresh" content="0;url={{ page.destination.url }}" /> </head> </html> {% endspaceless %}
现在,如果用户访问 alias-path.html
,则将被重定向到原始页面。