固定的CakePHP的.htaccess / mod_rewrite的共享主机设置 [英] fixing cakephp .htaccess/mod_rewrite for shared hosting setups

查看:239
本文介绍了固定的CakePHP的.htaccess / mod_rewrite的共享主机设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个共享的主机安装程序安装CakePHP的。解压缩文件到像一个位置后的〜/的public_html的/ dev /饼并访问相应的URL(本例中的 HTTP://主机名/〜用户名的/ dev /蛋糕/ ),我收到一个404错误:


未找到

I'm trying to install cakePHP on a shared hosting setup. After extracting the files to a location like ~/public_html/dev/cake and visiting the appropriate URL (in this case http://hostname/~username/dev/cake/), I receive a 404 error:


Not Found

所请求的URL的/ usr /家庭/用户名/的public_html的/ dev /蛋糕/应用程序/ webroot的/在此服务器上找到。


The requested URL /usr/home/username/public_html/dev/cake/app/webroot/ was not found on this server.


我怀疑这样做的原因是,仔细检查后,绝对路径为〜/的public_html 其实也不是的的/ usr /主页/用户名/的public_html 的/ usr /网络/用户/用户名/

I suspect that the reason for this is that upon closer inspection, the absolute path to ~/public_html is not in fact /usr/home/username/public_html, but rather /usr/www/users/username/.

这是我一直在努力(但显然它不工作): (〜/的public_html的/ dev /蛋糕/应用程序/ Web根目录/的.htaccess)

Here's what I've been trying (but obviously it's not working): (~/public_html/dev/cake/app/webroot/.htaccess)

<IfModule mod_rewrite.c>  
    RewriteEngine On  
    RewriteBase /usr/www/users/username/dev/cake/app/webroot/ 
    RewriteCond %{REQUEST_FILENAME} !-d  
    RewriteCond %{REQUEST_FILENAME} !-f  
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]  
</IfModule>

不幸的是,这似乎并没有改变任何东西(404消息仍然是相同的)。思考?

Unfortunately, this doesn't seem to change anything (the 404 message remains that same). Thoughts?

推荐答案

应该不是

RewriteBase /usr/www/users/username/dev/cake/app/webroot/

RewriteBase /~username/dev/cake/

<一个href="http://httpd.apache.org/docs/1.3/mod/mod%5Frewrite.html#RewriteBase"><$c$c>RewriteBase关心映射真实的URL,以虚拟的,我认为这就是你想要的。

RewriteBase cares about mapping real urls to virtual ones, and I think that's what you want.

这篇关于固定的CakePHP的.htaccess / mod_rewrite的共享主机设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆