问题描述
我想一个共享的主机安装程序安装CakePHP的。解压缩文件到像一个位置后的〜/的public_html的/ dev /饼并访问相应的URL(本例中的的 ),我收到一个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/
<$c$c>RewriteBase$c$c>关心映射真实的URL,以虚拟的,我认为这就是你想要的。
RewriteBase
cares about mapping real urls to virtual ones, and I think that's what you want.
这篇关于固定的CakePHP的.htaccess / mod_rewrite的共享主机设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!