Setup CakePHP mod_rewrite to work with GoDaddy shared Linux hosting package
Posted in Blogs and articles on May 4, 2009 at 11:32 IST (10 months ago). Subscribe to this post
Email
Showing comments 1 to 5 of total 5 on page 1 of 1
Post replyShowing comments 1 to 5 of total 5 on page 1 of 1
« Previous1Next »
cerulean...Rank: 3
I was getting into different issues after deploying my Cake PHP website to my shared linux hosting account at GoDaddy.
Basically, this is the setup I have (as per the cake standard of pointing the root of the website to app/webroot):
When I load up http://www.mysampledomain.com, I'm getting thrown at with a 500-Internal Server error.mysampledomain.com points to ~/html/siteroot/mysampledomain.com/app/webroot.
After 30-minutes of debugging around different .htaccess files of cake, I finally figured out two solutions. One is to point the domain to /html/siteroot/mysampledomain.com instead of app/webroot. This one, also documented at Cake's bakery website seemed too darn slow to me to afford as a solution.
Here's what I ended up with. Amazingly it turned out to be an easier fix.
For the fix to work, modify your app/webroot/.htaccess file to read the following:
The only change I have made is the extra slash (/) prefix added to index.php. No double, triple rewrites and not even a bit slower than you would expect.<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L]
</IfModule>
Happy baking!
Posted by ceruleancode on Monday, May 4, 2009, 11:32 am
How do you point the root of the website to app/webroot in goDaddy as per the sample below?
mysampledomain.com points to ~/html/siteroot/mysampledomain.com/app/webroot
mysampledomain.com points to ~/html/siteroot/mysampledomain.com/app/webroot
Posted by anonymous on Wednesday, September 2, 2009, 8:04 am
cerulean...Rank: 3
You don't need to do that step, it's just that I mentioned where is my webroot directory located in GoDaddy's filesystem. Your path will be different.
Two ways to figure this out are
- If you have enabled SSH access, just type pwd in the prompt
- Upload a file with <?php phpinfo(); ?> and access via a browser.
Posted by ceruleancode on Wednesday, September 2, 2009, 3:02 pm
Pages: « Previous1Next »