First of all, I want to describe that I have researched a lot on this question so thats why I am asking so please dont downvote. I have implemented lot of solutions.
I am using cake2.0. I have uploaded a website on development server the link is http://dev.infideaco.com/eventmanager/ . But I am getting the not found error. I have resolved it by changing the .htaccess files but then the css,js and images are still not available.
I have .htaccess files which are provided by default installation. I am setting it up in development server
/var/www/dev.infideaco.com/eventmanager
The website is running fine on other servers.
You can check here:
http://swirlsyogurtbar.com/js/
These are the htaccess files:
root file:<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule sss (.*) app/webroot/$1 [L]
</IfModule>
in app:<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
app/webroot/.htaccess:<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Please provide me the solution. Lot of thanks in advance
I would first check if server supports mod_rewrite. Also check this thread if you haven't already: cakePHP - 404- page not found error, when deploying on a different machine
root file:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
in app:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
app/webroot/.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Related
This is my webroot .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteBase http://localhost/myproject/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
This is project folder .htaccess file
<IfModule mod_rewrite.c>
#RewriteEngine on
#RewriteRule ^(\.well-known/.*)$ $1 [L]
#RewriteRule ^$ webroot/ [L]
#RewriteRule (.*) webroot/$1 [L]
</IfModule>
This file is in app folder .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
Can any one help me out with this?
Try with below htaccess codes
/var/www/app/webroot/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
/var/www/app/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
/var/www/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
There can be following reasons for 500 Internal Server Error in CakePHP application:
1) Your .htaccess files are not correct.
2) Permissions of folders are not correct. If CakePHP app is Group Writable i.e. 777 then webserver gives 500 error for safety.
3) You are missing Database Connection. Correct database configuration according to Webhost because most of times local and production server databases have different details.
4) Delete the content of your tmp folder. It is best practice that you must delete cache if you move your application from one place to another.
5) For testing purpose debug should be on like configure::write('debug',2);
6) If not succeeded check your Apache Error Log. If using Linux /var/log/apache2/error.log
Hope It Helps, Thanks!!
I am getting the error(mysite.com/cake-284/users/login):
404 - File or directory not found.
-after uploading the Cakephp 2.8.4 sub-directory to my PHP website in the live host.
But the subdirectory root(mysite.com/cake-284) shows:
500 - Internal server error.
The site is running fine in the localhost by the wamp server (PHP Version 5.5.12).
I believe this is the problem of my .htaccess file(s). After searching for a solution, I found Set up CakePHP in a subdirectory; Wordpress is installed in the root, and cakephp inside a subdirectory. But these didn't help.
There is no .htaccess file in the root.
mysite.com/cake-284/app/webroot/.htaccess :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
mysite.com/cake-284/app/.htaccess :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
mysite.com/cake-284/.htaccess :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Cakephp 2.8.6, PHP Version: 5.5.35
I don't know if there is anything else to do with the rewrite.
Edit .htaccess with you sub directory
mysite.com/cake-284/app/webroot/.htaccess :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cake-284
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
mysite.com/cake-284/app/.htaccess :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /cake-284
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
mysite.com/cake-284/.htaccess :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /cake-284
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
I have a small question.
I have build a system and it is using a .htaccess to direct the traffic to the correct locations.
Now I have the following .htaccess data
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ core/ [L]
RewriteRule (.*) core/$1 [L]
///### (does not work.. this is a problem) RewriteRule (.*) app/template/ !page [L]
</IfModule>
The problem is actually that when I want to show a .css file located in /app/templates it also redirects to /core/
I tried to make an exception. However that does not really seem to work at my method.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ core/ [L]
RewriteRule (.*) core/$1 [L]
RewriteRule (.*) app/template/ !page [L]
</IfModule>
This .htaccess gives a 500 error.
Could anyone tell me what I am doing wrong? And how I can make the exception work for the template directory?
TIAD!!
You should use:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ core/ [L]
# If the request is not for a valid directory
RewriteCond %{REQUEST_FILENAME} !-d
# If the request is not for a valid file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) core/$1 [L]
</IfModule>
I am running into an infinite redirection loop when setting up CakePHP on a bluehost server.
I have set my .htaccess as follows,
Under /home/mysite/public_html/site2 (I have configured an add-on domain with site2 as its serving directory on BlueHost)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Under /home/mysite/public_html/site2/app as,
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
And finally under /home/mysite/public_html/site2/app/webroot as,
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
If I remove the two RewriteCond from the .htaccess under webroot the Cake controllers start working but I don't see any images or CSS. I am not sure where am I going wrong.
creat a htaccess in root same as
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site2\.tld[NC]
RewriteRule ^$ site2/app/webroot/ [L]
RewriteCond %{HTTP_HOST} ^site2\.tld[NC]
RewriteRule (.*) site2/app/webroot/$1 [L]
</IfModule>`
and htacess in site2 folder must be
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
Building a CakePHP website for a client, it runs perfectly on my local environment, and when being tested on my server. However, when I transferred it to the client's site5 server it returned nothing but 404 errors.
After some modifications to the .htaccess files I was able to get the default landing page working fine:
http://174.120.222.98/~sty/
The issue I have, is that only the default landing page can be found. All of the sub-pages are still returning 404 errors (example: "NEW STUDENTS" Green-background link in NavBar).
I've changed the root/.htaccess file to:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /~sty
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
without RewriteBase /~sty The default landing page is a 404.
I've changed root/app/.htaccess file to:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
Without this change, none of the files in webroot loaded (images/styles/js).
Those two files alone seem to be all I need for the default page, I can even remove the root/app/.htaccess file and the landing page looks great. So I'm assuming the app file is the one that will govern my sub-pages. Nothing I've done to it seems to work, it is currently set to:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /~sty
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
I've tried to RewriteBase with \, \~sty, \~sty\app and without the line so far none of my changes seem to work.
Help me StackOverflow, you're my only hope.
mod_rewrite is not enabled on your server so you have to handle this with .htaccess file in your root directory
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
and another .htaccess in your app folder
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
and another one in your webroot folder
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>