Laravel 8 Images of Subpages/Routes are not Loading - laravel

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>

Related

Laragon - access wordpress folder inside laravel app

I have a Laravel app and I want to install WordPress inside that app. So, the folder structure will be like this:
my-laravel-app
- app
- bootstrap
- blog <--- This is the WordPress folder
- wp-admin
- wp-content
- wp-includes
...
- config
- database
...
I can access my laravel app using this link in laragon:
https://my-laravel-app.test
But, when I access the blog folder, it causes 404 NOT FOUND
https://my-laravel-app.test/blog
Here's the my-laravel-app/.htaccess file
<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>
Here's the my-laravel-app/blog/.htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /my-laravel-app/blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /my-laravel-app/blog/index.php [L]
</IfModule>
# END WordPress
What configuration should I do to make this link https://my-laravel-app.test/blog work?

Failed to load resource: the server responded with a status of 403 (Forbidden)- Laravel 8 problem with htaccess

I got error in my website after I add .htaccess file in the root folder of my website, I use laravel 8 and storage in my website, note i have run php artisan storage:link, please help me anyone. thank you
this is .htaccess configuration :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
and this is my .htaccess configuration in public directory :
<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>

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

LARAVEL - cannot access my public folder via URL

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.

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