Server 500 error - moved app in subfolder - php

I developed an application in a subfolder of my website and it worked fine.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|swf|uploads|js|css|robots\.txt)
RewriteRule ^(.*)$ /app/index.php/$1 [L]
</IfModule>
This file was working fine so and index.php was not required to navigate within the application. Now I moved the application to root of website and changes the last line to
RewriteRule ^(.*)$ index.php/$1 [L]
Now I have start getting Internal Server Error 500. I am not sure that it is something I have done or the .htacces is required to be configured differently. It might be an issue with host too, but I want to exhaust my options first.
Any help will be appreciated. Thanks in advance.

if you in root of hosting you just need
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|swf|uploads|js|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
if you site in folder /foo you need:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /foo
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|swf|uploads|js|css|robots\.txt)
RewriteRule ^(.*)$ /foo/index.php/$1 [L]
</IfModule>
if still not working try this, for me it works all over:
RewriteEngine On
RewriteBase /foo
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /foo/index.php/$1 [L]

Related

CodeIgniter 404 Page Not Found htaccess

I got 404 Page Not Found when I tried to access my file without the index.php.
this is my .htaccess.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /HR/
# If your project is in server root then should be: RewriteBase/
# If project is in folder then it should be: RewriteBase /folder_name/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^.(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
I have been using this one
Place this in main directory out side of application folder.
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Also make sure if your using codeigniter 3 that the first letter of class and file name must be uppercase only.
.htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Note: .htaccess vary depending on server. In some server (e.g.: Godaddy) need to use the following .htaccess:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

iPage "No input file specified." on /admin page

I'm having this problem my app which is build in codeigniter 2.14 was working fine in my localhost using xammp but when i migrated it to my hosting server which is iPage.com i can no longer access my dashboard it prompts a No input specified error.
Options +FollowSymlinks -MultiViews -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
# If the user types "index.php" or "admin.php".
RewriteCond $1 !^(index\.php|admin\.php|images|robots\.txt)
# If the user types just "admin".
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^admin$ admin\.php [L,QSA]
# If the user enter in any admin section, like "admin/section".
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^admin\/(.*)$ admin\.php/$1 [L,QSA]
# If the user types any site section, like "site/section".
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index\.php/$1 [L,QSA]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
fixed this using cgi bin on my root folder
Just add the following to the .htaccess file :
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]

Slim Framework proper htaccess setup with wordpress

I want to make an api with slim. it would be on my "tools" subdomain in a directory called api.
http://tools.fifaguide.com/api
What should my .htaccess file look like?
Currently my .htaccess is located in my Wordpress directory (html -> .htaccess), and it looks like this:
<IfModule mod_rewrite.c>
//my part
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/api/index.php
RewriteRule ^api/(.*) http://tools.fifaguide.com/api/index.php [L]
//wordpress part
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
The problem with this is that when I try
http://tools.fifaguide.com/api/hello/steve
I imediately get redirected back to api/index.php instead of staying on /api/hello/steve and having the results shown.
Its seems like wordpress is making this happen, but how do I prevent it?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/api/ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ api/index.php [QSA,L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

.htaccess returns 500 for a simple redirect in Laravel

I have created an app in Laravel.
My initial .htaccess was:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
And it worked properly for the domain api.viglug.org.
After I added the m.forum.viglug.org domain (with the same root directory of api.viglug.org).
At this point was exactly the same to call api.viglug.org and m.forum.viglug.org.
I wanted to use the m.forum.viglug.org for the folder api.viglug.org/mobile so I thought it would have worked with this .htaccess:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_HOST} m\. [NC]
RewriteRule ^(.*)$ index.php/mobile/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
I was wrong. It keeps returning error 500 if I use m.forum.viglug.org, while api.viglug.org works as expected.
How can I fix this?
The original rewrite only runs on files which do not exist as real files or directories, due to these two conditions:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Have you tried adding those two conditions above your additional rule?
# Mobile site
RewriteCond %{HTTP_HOST} m\. [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/mobile/$1 [L]
# Normal site
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

VHost & htaccess - 500 Internal Server error

I use ISPConfig 3 to manage my domains/subdomains.
I added subdomain parim.kristian.ee which would redirect to web/parim/ (note: web/ is my document root).
ISPConfig generated such redirect to apache config:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^parim.kristian.ee [NC]
RewriteRule ^/(.*)$ /parim/$1 [L]
Now if i'll try to get static resources, such as http://parim.kristian.ee/images/1x1.gif, it serves fine, but when redirect is to codeigniter, it doesn't work.
Htaccess in web/parim/ looks like this:
<IfModule mod_rewrite.c>
RewriteEngine on
Options -Indexes
#Handle CodeIgniter request
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 ./index.php
</IfModule>
NOTE: accessing the same folder via http://kristian.ee/parim/ works!
I s*ck at htaccess, so any help is appreciated.
# To remove index.php from URL
RewriteEngine On
RewriteBase /parim
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Or Simple remove RewriteBase /parim

Categories