500 error on bluehost server for CakePHP application - .htaccess

I have uploaded my application on bluehost server. I have uploaded it on public_html.
htacces on root
/.htaccess permission 644
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
/app/.htaccess permission 644
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
/app/webroot/.htaccess permission 644
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
url is http://consumersinchrist.org/. Please help.

Go to cpanel->PHPConfig and enable FastCGI , it will work like a charm :)

Is this a new host for you? When I switch hosts, there's usually a unique small configuration that needs to be done to get my custom apps to work.
Check out these links from BlueHost:
Help 1
Help 2

Related

Cakephp CSS file not loading

I have a website working on one server. I am changing hosting, so I created a website on another server for testing.
Everything seems to be working, except CSS. It is not loading at all. I have 777 for tmp folder and mod re_write enabled.
I can see all cached files except for CSS.
Please advise and help
This is my .htacess file in www
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
This is my second htaccess inside app
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
This is my third htaccess inside webroot
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
and the url is 23.236.49.24
Add this line:
RewriteBase /
under
RewriteEngine On
in the 3 .htaccess files
Create .htaccess file in webroot folder.
And paste this code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

1and1 subdirectory cakePHP installation issue

I am deploying my app on a live server hosted on 1and1.co.uk.
I am trying to make it work since 8 and getting crazy, trying with a fresh version downloaded from the cakePHP website.
Here is my configuration.
A subdomain pointing to a directory :
subdomain.mydomain.com => /subdirectory
So I think the first question is, on the view of my app, is that a subdirectory ?
I don't think so but I am not sure.
I tried hundreds of .htaccess configurations, nothing works, I get a 500 error or the following message:
Parse error: syntax error, unexpected '=', expecting '(' in /homepages/41/d201409564/htdocs/hire/lib/Cake/bootstrap.php on line 173
I thought that topic would fix my problem, but still not working.
Thanks for your help
Could fix it finally thanks to : http://www.grafikart.fr/forum/topic/2351
Here is the solution, the trick is probably to enforce the PHP5, even if it's activated on your server (which is my case)
/.htaccess
AddType x-mapp-php5 .php
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
/app/.htaccess
AddType x-mapp-php5 .php
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
/app/webroot/.htaccess
AddType x-mapp-php5 .php
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>
If someone struggles about this with CakePHP 4.xx, this is how i got it running at IONOS (former 1and1). CakePHP is installed in a Subdirectory:
(Maindirectory)
Subdirectory (CakePHP)
/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
#the next two lines are only for forwarding to https
RewriteCond %{SERVER_Port} !=443
RewriteRule ^(.*)$ https://yourdomain.com/$1 [R=301,L]
# end of forwarding
RewriteBase /
RewriteRule ^(\.well-known/.*)$ $1 [L]
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
webroot/.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

htaccess and cakephp - whats the correct path/to/app in this situation

I'm trying to install cakephp on a 1&1 account but running into problems.
I believe I need to add
RewriteBase /path/to/cake/app
to the htaccess file but I can't figure out what the path should be.
I have put the cakephp files in a folder called scissors on the most bottom level of folders I can browse to using filezilla. With that in mind I tried
RewriteBase /scissors/app
but that didn't work. What should it be?
EDIT:
I have managed to get the site to work (sort of) but unfortunately the css doesn't seem to get loaded.
The three htaccesses which I have which are working but not pulling the css are:
in /scissors
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /app
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
in scissors/app
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /app/
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
in scissors/app/webroot
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /app/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
Does anyone have any idea why this isn't correctly loading the css?
thanks
Answer is for cake 2.0 and I'm assuming that you've unzipped downloaded archive inside your public_html, so the path to cake looks like
/home/your_login/public_html/scissors/files_and_folders_unzipped_here
Or just
/public_html/scissors/files_and_folders_unzipped_here
as
/home/your_login
may not be visible.
Inside "scissors" folder (where app, lib, plugins, vendors etc folders are) place .htaccess with
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Inside "app" folder
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
And inside "webroot" folder
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
There is one more way to install cake (allows to have multiple sites on one "core config") but unzipping everything inside public folder is the easiest one.

Making CakePHP 2.0 work on a subdirectory

I have my site www.mysite.com in /var/www/
and I added my cakephp app in /var/www/developer
when I go to www.mysite.com/developer I get the login page fine and after I login the app takes me to the home page OK. But whenever I click on other link I get
"Page not found"
I have 3 htaccess
/var/www/developer
/var/www/developer/app
/var/www/developer/app/webroot
What should I put on those to make my urls work?
Thanks
Your .htaccess files should probably look like this:
/var/www/developer
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
/var/www/developer/app
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
/var/www/developer/app/webroot
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
You also should have right paths defined in /var/www/developer/app/webroot/index.php
instead of
if (!defined('ROOT')) {
define('ROOT', dirname(dirname(dirname(__FILE__))));
}
try something specify the right way (eq. DS . 'www' . 'develop')
usually it is enough to redefine just CAKE_CORE_INCLUDE_PATH but sometimes youe needed define all three ROOT WEBROOT_DIR nad CAKE_CORE_INCLUDE_PATH

CakePHP .htaccess mod_rewrite configuration to exclude a particular folder/url

I have a CakePHP installation in a sub folder in my server, I want to install another application inside that subfolder:
root/public_html/subfolder/cake/
root/public_html/subfolder/app/
etc. now I need a custom application installed there:
root/public_html/subfolder/my_custom_application/
I have something like this in my .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
How can I configure it to exclude the "my_custom_application" folder from that rules?
I tried this:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule ((?!my_custom_application).*) app/webroot/$1 [L]
</IfModule>
But I get this:
Error: The requested address '/y_custom_application' was not found on this server.
Thanks in advance.
Mauricio.
How to Exclude a Directory from CakePHP Routing:
I ran into the same problem as you. I struggled, but finally found something that worked.
(I'm replying because the answer above didn't work for me, but this did).
My directory structure:
root/public_html/app/
root/public_html/lib/
root/public_html/plugins/
root/public_html/vendors/
root/public_html/directory_to_exclude/
What I added to CakePHP's default routing:
RewriteCond %{REQUEST_URI} !^/directory_to_exclude/(.*)
Effectively, I needed to allow people to access the subfolder separately (since that has a separate application). Also, in my case, I'm serving a CakePHP application by default from the root directory.
So here's what my CakePHP 2.x htaccess looks like:
Updated .Htaccess (this works for me)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/directory_to_exclude/(.*)
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
In your case, I understand you need this to work in a subfolder; here's my adjusted htaccess I didn't have a chance to test this, but I believe this (or something close) will work:
The Final Product (for a subfolder)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/subfolder/directory_to_exclude/(.*)
RewriteRule ^$ subfolder/app/webroot/ [L]
RewriteRule (.*) subfolder/app/webroot/$1 [L]
</IfModule>
Put this before the RewriteRule lines:
RewriteCond %{REQUEST_URI} !^/my_custom_application
You have to replace dir_to_exclude by your dir name.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/(?:dir_to_exclude)(?:$|/)
RewriteRule ^$ app/webroot/ [L]
RewriteCond %{REQUEST_URI} !^/(?:dir_to_exclude)(?:$|/)
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
If you want to have more than one excluded directory you have to add them separated by |additional_dir_to_exclude
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/(?:dir_to_exclude|additional_dir_to_exclude)(?:$|/)
RewriteRule ^$ app/webroot/ [L]
RewriteCond %{REQUEST_URI} !^/(?:dir_to_exclude|additional_dir_to_exclude)(?:$|/)
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>

Resources