我有一個URL www.domain.com/example,我將其更改爲www.domain.com/example2/example3。它工作正常。但是當我手動訪問舊的URL時,它是可訪問的,但我需要的是它應該被重定向到新的URL。Cakephp URL重寫和重定向
2
A
回答
2
Router::redirect(
'/example',
'/example2/example3',
array('persist' => true)
);
http://book.cakephp.org/2.0/en/development/routing.html#redirect-routing
0
做到這一點最簡單的方法就是例子
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (.*) http://domain.com/example2/example3 [R]
</IfModule>
並刪除所有例子代碼在.htaccess文件。
0
TRY:
如果www.domain.com/example使用控制器=>示例和動作=> 索引
然後使用:
Router::redirect(
'/example1/example2/*',
array('controller' => 'example', 'action' => 'index'),
array('persist' => true)
);
相關問題
- 1. URL重寫和重定向
- 2. URL重寫和301重定向...重定向到原始URL
- 3. URL重寫重定向
- 4. ASP.Net 301重定向和URL重寫
- 5. URL重寫和重定向問題
- 6. URL重定向和重寫同時
- 7. ASP.NET URL重寫和重定向
- 8. 重定向永久,www重定向和url重寫
- 9. 重寫和重定向URL沒有重定向循環
- 10. Cakephp 1.3 url重寫
- 11. Url映射,Url重定向/重寫
- 12. 如何重寫url和重定向與Apache mod重寫?
- 13. IIS7 URL重寫 - 爲什麼重定向工作和重寫不?
- 14. Apache重定向和重寫
- 15. Apache重寫和重定向
- 16. 重寫彈簧安全重定向URL
- 17. URL重寫/重定向/使用的.htaccess
- 18. 無限重定向循環 - 重寫URL
- 19. 重定向循環URL重寫
- 20. URL重寫重定向問題
- 21. 重定向到一個重寫的URL
- 22. URL重寫失敗:內部重定向
- 23. 重寫重定向的URL與mod_rewrite的
- 24. 通配符重定向url重寫web.config
- 25. .htaccess用ssl重定向url重寫
- 26. 子站點重定向URL重寫
- 27. IIS URL重寫不是重定向子
- 28. URL重定向/使用.htaccess重寫
- 29. URL重寫重定向導致
- 30. 的.htaccess重寫URL啓動/重定向
thanx .. It works .. – 2014-11-10 05:42:20