LARAVEL - cannot access my public folder via URL - laravel

I cannot acces my files in public folder via URL,while using artisan as server
For example:
IN CHROME
http://localhost:8000/images/wolf.png give me ERR_INVALID_HTTP_RESPONSE
FIREFOX give me
in IE it works fine
I dont know if it has something to do with it but there is some kind
of block on icon. Then i added other images so those are not all.
My htaccess:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
I tried set up new project but problem still persist.

Related

Problem loading page "404 not found Error" in Laravel Project

I have created a website that was working fine, but now I am getting 404 not found error.
The live url is glucolight.co.uk
The main page is loading but all other pages show 404 not found.
I have .htaccess file in public folder with below content
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I have tried putting same .htacces in root, in that case i get 500 general error.
Any solution please.

Laravel 8 Images of Subpages/Routes are not Loading

all the images of my Laravel 8 Subpages/Routes are not Loading. It seems like a misconfiguration of my .htaccess file in the public directory. I cant find whats causing the problem. All the Images on the Startpage/index Site load completily fine. The Site is running on a Apache2 Webserver in a Subdirectory "/blog".
Here is my .htaccess File from the public directory:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteBase /blog/
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

Getting 500 server error just in the index page of laravel

I am newbie to the plesk panel. The problem I am having is, I am only getting 500 server error in the index page. Other page of the same website opens perfectly except index. There is a following code in the .htaccess file of my project:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
What should I do to make the index page work like other pages? Do I have to add codes to .htaccess file?
It is not the index.php. The issue is about permissioning.
Execute
sudo chmod -R 755 folderforaccess
and
chmod -R o+w folderforaccess/storage
On live server you can do:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
then also make sure that the php version in your composer.json is the same as that of your server.
Check your php version in your terminal using php -v

I'm forcing SSL with htaccess but it isn't working with URLs that link to files

I realised that my site is not redirecting correctly when the URL link to a file (a pdf in this case). The others urls of my site are working perfectly. This is my htaccess file:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
It's strange because after differents ways of typing my url I found this:
If I type "myweb.com/urltopdf", it is redirected to "https://myweb.com/urltopdf"
If I type "https://myweb.com/urltopdf", URL works
If I type "http://myweb.com/urltopdf", it isn't redirected and the url doesn't work. This case is my problem.
I dont know if it's important but I am using laravel 5.2.
Thanks.
EDIT: It works on firefox and edge but not on chrome.

All page show 404 apart from index

Even /home is 404. I just start learning laravel, I don't know if I did something wrong.
After reinstall composer and created a new project the problem still
exist.
Xampp is running.
Here is the .htaccess in public:
<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}]
</IfModule>
have you added Route::get(/home, HomeController#index); to your routes file?

Resources