I am having an issue with the .htaccess file i think. I recieve constant internal 500 errors. I have tried many different solutions around the web. Here is what my .htaccess files look like:
ROOT ACCESS
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
app/ HTACCESS
<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 [QSA,L]
</IfModule>
Notice: my project is in root directory - public_html/
Related
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>
askpapa.in/askpapaFinal is opening fine.
See the problem here
root htaccess file
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /askpapaFinal/
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
App Folder Htaccess file
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /askpapaFinal/
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
webroot htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /askpapaFinal/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I have a PHP MVC frame work.
I created a subdomain but it gives the error 500.
My root .htaccess file is like this:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ all_users/ [L]
RewriteRule (.*) all_users/$1 [L]
It redirects to the "all_users" folder.
The "all_users" root .htaccess is like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
The subdomain folder is in root of site.
How should I change the .htaccess file(s) for subdomain
redirection. Thanks.
I found the answer.
This is the .htaccess file in root of site:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain.domain.com$ [NC]
RewriteRule (.*) / [L]
RewriteRule ^$ all_users/ [L]
RewriteRule (.*) all_users/$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]
I have installed my cakephp on a shared host server.
I always get a 404 error
The mod_rewrite looks like this
/home/user/public_html/cms/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
/home/user/public_html/cms/app/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
/home/user/public_html/cms/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>
The url is http://server/~user/cms and the server path is /home/user/public_html/cms
you have to add the RewriteBase to remove http://server/~user/ from the url. cake does not work with ~ in the url