Error 500 MVC with subdomain - php

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>

Related

Error in Cakephp 2.8.4 as sub-directory inside a core PHP website

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>

htaccess with cakephp on linux host cpanel 500 error

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/

Configuring .htaccess files for CakePHP and Wordpress

I have already visited this link:
Configure .htaccess file for multiple environments
But it hasn't resolved my problem.
I am unable to access CakePHP folder from Wordpress directory. This is the .htaccess file of my root:
RedirectMatch 404 /\\.svn(/|$)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /myer
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /project/trunk/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /project/trunk/index.php [L]
</IfModule>
# END WordPress
This is the .htaccess file of "myer" directory:
RedirectMatch 404 /\\.svn(/|$)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /myer
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
This is the .htaccess file of "myer/app" directory:
RedirectMatch 404 /\\.svn(/|$)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /myer
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
This is the .htaccess file of "myer/app/webroot" directory:
RedirectMatch 404 /\\.svn(/|$)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /myer
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
What I am getting out of these .htaccess files is "Object not found! - Error 404". What am I doing wrong?

Cakephp css,images and subpages are not loading

My website(http://www.mytripkerala.com/) which is built in cakephp works well in old server.When i changed it to my new server the homepage is loading without style and images.And all subpage links showing 404 error.My htaccess files are
htaccess inside webroot
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
htaccess inside app folder
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
htaccess outside app folder
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Please help me to solve the problem..

Laravel Shared Hosting .htaccess

I am trying to deploy a Laravel project onto a share hosting, I've managed to get most of the hard work done but I cannot strip off the /public directory without a Forbidden issue.
The website works and shows same pages for these links
www.mywebsite.com/test/index.php
www.mywebsite.com/test/public/
But without the /index.php It returns ->
Forbidden
You don't have permission to access /test/ on this server.
Currently my .htaccess looks like the following.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ public/index.php [L]
</IfModule>
Any ideas?
this is the magic script i use (add to the .htaccess in public_html)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Try this rule in test/.htaccess:
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /test/
RewriteRule ^$ public/index.php [L]
RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ public/index.php [L]
RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
</IfModule>
This script is working for me.
<IfModule mod_rewrite.c>
RewriteEngine On
# Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Remove public folder form URL
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

Categories