Mod Rewrite on Godaddy Shared Hosting
For those having trouble getting cake to work on godaddy.
To get cake to work on a godaddy shared linux hosting account.
Another Better Solution (Kudos to ceruleancode)
1. Upload to Server
2. Alter 1 .htaccess file
For the fix to work, modify your app/webroot/ .htaccess file to read the following:
Download code
Notice the / in front of the index.php. That simple change makes everything work great. If your project is in a folder (www.domain.com/application) just appended it to the beginning /application/index.php.
===Old Way of Doing it====
1. Upload cake to the server, unpacked before uploading is best.
2. For these instructions to work, the domain has to be set to the root of the cake folder. i.e. domain.com or subdomain.domain.com will work. domain.com/cakephp has not been tested with these instructions
3. Alter 3 .htaccess files
.htaccess in root folder of cake, change the file to read this:
Download code
.htaccess in /app/ folder:
Download code
.htaccess in /app/webroot/ folder:
Download code
Let me know if this was helpful or you can build off of it!
Another Better Solution (Kudos to ceruleancode)
1. Upload to Server
2. Alter 1 .htaccess file
For the fix to work, modify your app/webroot/ .htaccess file to read the following:
Download code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L]
</IfModule>
Notice the / in front of the index.php. That simple change makes everything work great. If your project is in a folder (www.domain.com/application) just appended it to the beginning /application/index.php.
===Old Way of Doing it====
1. Upload cake to the server, unpacked before uploading is best.
2. For these instructions to work, the domain has to be set to the root of the cake folder. i.e. domain.com or subdomain.domain.com will work. domain.com/cakephp has not been tested with these instructions
3. Alter 3 .htaccess files
.htaccess in root folder of cake, change the file to read this:
Download code
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
.htaccess in /app/ folder:
Download code
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
.htaccess in /app/webroot/ folder:
Download code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L]
</IfModule>
Let me know if this was helpful or you can build off of it!
Comments
Comment
1 Slow cakePHP if httpd.conf not changed.
Comment
2 Thanks Kirby, it work for me.
My cake's application is host on root directory, and others domains, sub-domain is host on sub-directory : /blog, /forums...
To work on sub-directory, i have added this .htaccess file to sub-directory:
Ex: in directory: /blog, add this .htaccess file
View Template:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /blog/
</IfModule>
Thank you very much.
Comment
3 Works but Sloooooowwwww.
Comment
4 Works but......
Any ideas?
Comment
5 There's a faster solution
I also ran into the same issue of the website behaving sooo slow on applying this three level mod_rewrite solution. Finally after 30-40 minutes of debugging, I resorted to an easier solution that's also a simpler fix:
It's just the slash prefix on index in the webroot level. I've posted the solution in detail on my blog at TechieDesi Developer Community, let me know if it works for you guys:
http://techiedesi.com/post/327-setup-cakephp-modrewrite-to-work-with-godaddy-shared-linux-hosting-package
Cheers,
Cerulean
Comment
6 Thanks
Comment
7 Works
great job, I updated the article with the change but left old way in case anyone has trouble with it.
Comment
8 Thanks
Comment
9 Mod_rewrite with godaddy
Frankly, I avoid GoDaddy like the plague, especially for hosting. Nothing but bad experiences with them.
But now i have create a website on shared hosting .check this out
http://www.webhostingreport.com/best-shared-hosting.html
Comment
10 Nice Post.
Hence the $this->redirect in the code, Lez Sohbet and the return statement Bayan Chat (that you left out in your Bayan Sohbet copy-paste, Almanya Chat but it's in the original ;-) Arkadaş Sohbet This will make sure the view will Porno Sohbet not be rendered, Diyarbakır Sohbet and you will be redirected. Lez That's why you don't need to "prepare" Mirc indir the view by setting variables for it.