I am trying to migrate my laravel web app to hosting server, uploaded contents and changed the database configuration.
Then I pointed to my web browser like : www.mywebsite.com it will shows 500 internal server error
Is there any problem in my htaccess file. ?
<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>
or I am working with BITBUCKET GIT.is there any problem with GIT Usage. ?
Thanks & regards
Posting my own answer. Make sure your folders have 755 permission. I cleared this issue with permission. This is first thing do any others. You can get successful output.
No Issues with .htaccess and GIT.
Related
2 questions actually:
How do I setup a Laravel site in a subfolder?
How do I flush/clear the cache?
My current situation:
I'm on shared hosting (don't mock me....I know dedicated server is better....trying to figure out how much budget to allocate for it so currently using shared since I can pay monthly) and can't use SSH.
URL structure is like this: website.com/v2 where "v2" is the subfolder where the site is installed on.
Is this the way my .htaccess and index.php are supposed to be setup?
.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /v2/
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
index.php
require __DIR__.'/../v2/bootstrap/autoload.php';
$app = require_once __DIR__.'/../v2/bootstrap/app.php';
For clearing the cache, I got this code in routes.php:
Route::get('/v2/configcache', function() {
$exitCode = Artisan::call('config:cache');
print_r($exitCode);
});
Are all of the codes above setup correctly? When I go to mywebsite.com/v2/configcache, I get an "Under Construction" message.
I need to clear the cache because I updated the database info.
I want to host a laravel project in a dedicated server(aws, ubuntu 14.04).
So I placed the project in /var/www/html. When I go to 11.111.11.111/projectFolder/public the default welcome page is showing up,
but when I move to 11.111.11.111/projectFolder/public/login, I get an error - Page not found, interestingly 11.111.11.111/projectFolder/public/index.php/login, the login page is showing up but styles and jss files are missing.
Failed to load resource: the server responded with a status of 404 (Not Found)
http://11.111.11.111/js/app.js Failed to load resource: the server responded with a status of 404 (Not Found)
All these css and js files are present in public folder of laravel app.
These work perfectly when I run project using php artisan serve
The .htaccess file is as below,
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
I just want to change the .htaccess file, so when I type 11.111.11.111shows the application as when run normally.
If you want to see your project directly with http://11.111.11.111, you must change the DocumentRoot setting in your httpd.conf file.
In your /etc/apache2/sites-available/000-default.conf file, change the directory root to:
DocumentRoot /var/www/html/projectFolder/public
I have done my project using laravel. I want to upload my project on 1and1. I set my directory structure on 1and1 is as '/directory' which contains index.html file which links to the other page in /directory/EngageV1/public/auth/login. but when I visits this page I am getting the error page as,
Multiple Choices
The document name you requested (/index.php) could not be found on this server. However, we found documents with names similar to the one you requested.
Available documents:
/index.html (common basename)
Please consider informing the owner of the referring page about the broken link.
My .htaccess file looks like,
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.php [L]
</IfModule>
If enter url as /directory/EngageV1/public/ then it shows me the welcome page which I have set in routes.php file for route as '/'. Only this page works fine,I don't know what to do, Please give any suggestion.
Replace default contents in your .htaccess file under your the public
folder with the following.
RewriteBase /
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
If you still have problems look at this tutorial about how to deploy a Laravel webapp to 1and1
I know this is is an very old topic, but it took us some time today to find out what's going wrong on an old 1and1 (now Ionos) server. Turned out, the "multiple choices" page doesn't com from Option +MultiViews / mod_negotiation, but from a module called mod_speling that's running there by default. You can disable it in the .htaccess file:
<IfModule mod_speling.c>
CheckSpelling off
</IfModule>
I have a fresh installation of Laravel. It works perfectly fine on my local machine. But on the server the routes doesn't work correctly.
Here's how the URL looks like on my localhost:
localhost/articles/14
But when I try the same URL on my production server it doesn't work. But it does work if I type the URL like this:
mydomain.com/index.php/articles/14
So, with the index.php in between it works fine. And the index route works without a problem. So it seems like some kind of redirect issue.
Here's how my .htaccess file looks like:
<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 tried adding RewriteBase /mypath/ to the .htaccess without luck.
I have searched on Google and tried some suggestion without luck.
Check if mod_rewrite is enabled on your server.
Also, .htaccess may be disabled on your server for security reasons.
Try putting your mod_rewrite on your <VirtualHost> or <Directory> section.
I try to make a site using Laravel. When I put Laravel to "www" folder and browse
localhost/laravel/public
then I get a internal server error.
In error log display the following message.
/var/www/laravel/public/.htaccess: Options not allowed here
before put a post I saw similar problem here https://stackoverflow.com/questions/21097240/ and I didn't see any solution.
This is my .htaccess file
<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]
You have a .htaccess file in the directory /var/www/laravel/public with an Options directive in the wrong place.
You can only use the Options directive in a <directory> block.
You need to remove it, move it to the correct place or otherwise edit the file to correct the error.
See the Apache reference here