CakePHP installation in /~username/
In a recent project for of our client the domain had not yet transfered to the new server and we had to install and demo a CakePHP app from a URL which was something like http://ourdomain.tld/~username/
While everything worked properly on the local machine the above URL was giving 404 Not found Errors. We solved it pretty easily but today on the CakePHP group I came across a post where the user had a very similar problem... So I thought that I might as well write the solution so that it can help more people
The solution involves editing the .htaccess file and adding the /~username/ to the path. The default outer most .htaccess looks like
-
<IfModule mod_rewrite.c>
-
RewriteEngine on
-
RewriteRule ^$ app/webroot/ [L]
-
RewriteRule (.*) app/webroot/$1 [L]
-
</IfModule>
Just change it to
-
<IfModule mod_rewrite.c>
-
RewriteEngine on
-
RewriteRule ^$ /~username/app/webroot/ [L]
-
RewriteRule (.*) /~username/app/webroot/$1 [L]
-
</IfModule>
The above worked for us, may be you will also need to make corresponding changes in the .htaccess which is in the /app
Thanks to Abbas Ali for this solution
Update: The solution is already there in the manual which consists of using RewriteBase /~username/ - but I am sure it was not there the last time I read it!
About this entry
You’re currently reading “ CakePHP installation in /~username/ ,” an entry on SANIsoft – PHP for E Biz
- Published:
- 6.21.07 / 11:36am
- Author:
- Tarique Sani
No comments
Jump to comment form | comments rss | trackback uri