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.
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!
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