Getting internal error when trying to access website live - .htaccess

Getting following error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster#api.example.com.au to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
I pushed live codeigniter project, I updated .htaccess , database file, config file.
.htaccess file contains following code
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|css|js|images|robots\.txt)
RewriteRule ^(.*)$ index.php?$1 [L]
Options -Indexes
The Codeigniter project is inside api.websiteName.com folder and it is not in public_html, if i remove the index.php and htccess file and upload "index.html" file for testing purpose , then index.html works fine but when I upload index.php and .htaccess files back , it says Internal server error 500, There are many answers for same question, I followed answers and did update .htaccess file but nothing works. Folder permissions set as 755 but still getting same error. Any help would be much appreciated.
PHP verison is higher than 5.6

You can try this .htaccess file in your code.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
<IfModule mod_headers.c>
Header add Access-Control-Allow-Origin "*"
</IfModule>
<IfModule mod_env.c>
SetEnv CI_ENV development
</IfModule>
I hope it will help you..

Related

Internal Server Error in Production, but not in Local, and not on "/" route

A Slim (PHP microframework) app was developed. It works in localhost, but gets an error 500 in production. Here are the details:
It's fully working in local.
In production, the home route ("/") works, but all other routes throw an error 500.
If any specific route is put in the "/" route, it works.
The Slim site is hosted in a subdomain. A Wordpress site is hosted on the main domain.
It is hosted on a shared hosting by 1and1.
The exact error is:
Internal Server Error : The server encountered an internal error or
misconfiguration. Additionally, a 500 Internal Server Error error was
encountered while trying to use an ErrorDocument to handle the
request.
Several htaccess files were tried unsuccessfully.
Thank for your ideas to manage the issue!
You could try this one, it was working for an old project
<IfModule mod_rewrite.c>
# Activate this if you need to follow symlinks
#Options +FollowSymlinks
RewriteEngine On
# Explicitly disable rewriting for front controller
RewriteRule ^index.php - [L] RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php [QSA,L]
</IfModule>
can you please try this .htaccess file instead?
# Redirect to front controller
RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

.htaccess mod_rewrite 500 Internal Server Error

I succeeded to use .htaccess with mod_rewrite for my first domain name.
I try to use it for a second domaine name, and I have for result "Internal Server Error".
However, I put the same files on their server, and they have the same configuration.
The content of the .htaccess file :
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
Where can the problem come from ?
Best regards,
I found the solution, it's a problem with the encodage.
Getting Error 500 with this .htaccess on Linux, works fine on Windows

Laravel 5 internal server error after moving to the server

My laravel 5 project is works well on localhost. After moving the project to the server it shows an internal server error.
Error message
The server encountered an internal error or misconfiguration and was unable to complete your request.
I checked the requirements. All requirements are correct.
PHP = 5.5
Mcrypt PHP Extension = Enabled
OpenSSL PHP Extension = Enabled
Mbstring PHP Extension = Enabled
Tokenizer PHP Extension = Enabled
Both .htaccess files on the root and public folder are same,
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I tested by removing the both .htaccess files but it still shows the Internal server error.
How Can I fix this issue ? Any suggestions ?
check if mod_negotiation is enabled. I had the same issue just now
I have faced the same issue while migrating the shared server . The solution that worked me is as below.
Let's say there is laravel folder called test which contains folder structure of laravel.
I have use 2 different .htaccess file
1) one in the root folder of the (installed) laravel , i.e Along with test folder with content as below.
RewriteEngine On
RewriteCond %{REQUEST_URI} !^test/public
RewriteRule ^(.*)$ test/public/$1 [L]
2) One in the public folder i.e inside test/public with content as below.
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
It worked for me.

Laravel isn´t working on Shared Server based on Linux

does anybody know how to setup Laravel that it´ll work on a shared Server based on Linux?
I´ve tried default and alternative .htaccess files:
when I type a url which doesn´t exists and isn´t defined in routes.php I get this:
.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
when I type a url to a folder which exists but isn´t defined in routes.php I get a Redirect Loop
when I type a url to a file which exists but isn´t defined in routes.php I get same Error like first one
here the .htaccess files I´ve tried with (both behave same)
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
.
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Laravel 4 Internal Server Error 500 on Hostgator

I have a Laravel 4 app deployed on shared Hostgator server.
When I navigate to:
http://mydomain.com/laravel/public/
I can see the Laravel splash screen.
but when I try to access any other route to, say, /users or /posts I am getting
Internal Server Error 500
http://mydomain.com/laravel/public/posts
Controller:
public function index()
{
$posts = $this->post->all();
return View::make('posts.index', compact('posts'));
}
In Routes.php:
Route::resource('posts', 'PostsController');
I use Jeffrey Way's Generator to scaffold the posts entity.
The same works fine on my local machine. Controllers don't contain any logic, they only output the fetched data.
Error logs are empty.
Any ideas what to check? .htaccess, maybe?
Here is what I have there:
AddType application/x-httpd-php53 .php
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
As mentioned in comments, a 500 error without a corresponding log file entry from the application logger is likely an .htaccess file issue.
Since the OP found the issue is related to the rewrite (and not the directive to use php 5.3):
Since this is probably a common issue on Hostgator, you should check with their help docs.
However, my first stab at a fix would be to add a RewriteBase directive:
RewriteBase /
So it would look like:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Note that this assumes you're running the web application form the web root and not a sub-directory.

Resources