問題描述
我正在嘗試在共享主機(jī)設(shè)置上安裝 cakePHP.將文件解壓縮到 ~/public_html/dev/cake 之類的位置并訪問相應(yīng)的 URL(在本例中為 http://hostname/~username/dev/cake/),我收到 404 錯(cuò)誤:<小時(shí)>未找到
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
在此服務(wù)器上找不到請(qǐng)求的 URL/usr/home/username/public_html/dev/cake/app/webroot/.
The requested URL /usr/home/username/public_html/dev/cake/app/webroot/ was not found on this server.
我懷疑這是因?yàn)榻?jīng)過仔細(xì)檢查,~/public_html的絕對(duì)路徑實(shí)際上不是/usr/home/username/public_html,而是/usr/www/users/username/.
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/cake/app/webroot/.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?
推薦答案
不應(yīng)該
RewriteBase /usr/www/users/username/dev/cake/app/webroot/
成為
RewriteBase /~username/dev/cake/
RewriteBase
關(guān)心將真實(shí)網(wǎng)址映射到虛擬網(wǎng)址,我認(rèn)為這就是您想要的.
RewriteBase
cares about mapping real urls to virtual ones, and I think that's what you want.
這篇關(guān)于為共享主機(jī)設(shè)置修復(fù) cakephp .htaccess/mod_rewrite的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!