保定网站建设,网站推广,网站优化服务,保定专业的PHP网站制作机构!

Godaddy主机空间CakePHP .htaccess编写方法

发表于:2009年04月13日 21时  作者:dx_andy

CakePHP的框架默认的.htaccess不能完美支持Godaddy主机空间。也不是Godaddy空间的Htaccess有问题,而是我们没有写好.htaccess。您可以参考如下代码来配置您的CakePHP项目

Godaddy主机CakePHP项目主目录.htaccess
  1. <IfModule mod_rewrite.c>  
  2.     RewriteEngine on   
  3.     RewriteBase /   
  4.     RewriteRule    ^$ app/webroot/    [L]   
  5.     RewriteRule    (.*) app/webroot/$1 [L]   
  6. </IfModule>  
Godaddy主机CakePHP项目App目录.htaccess
  1. <IfModule mod_rewrite.c>  
  2.     RewriteEngine on   
  3.     RewriteBase /   
  4.     RewriteRule    ^$    webroot/    [L]   
  5.     RewriteRule    (.*) webroot/$1    [L]   
  6. </IfModule>  
Godaddy主机CakePHP项目webroot .htaccess
  1. <IfModule mod_rewrite.c>  
  2.     RewriteEngine On   
  3.     RewriteBase /   
  4.     RewriteCond %{REQUEST_FILENAME} !-d   
  5.     RewriteCond %{REQUEST_FILENAME} !-f   
  6.     RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L]     
  7. </IfModule>  

 订阅“PHPLAMP博客”方便及时获取网站内容

PHPLAMP博客是专注于网站建设,搜索引擎研究,网站推广,网站优化的IT博客。

发表一下您对本文的意见