Problem with run website on Laravel Valet - url not workings
Hi,
I download my website from my serwer (php 8.2, apache). I need change something on this website. When I try run this project locally, on Laravel Valet I have problem with url,. Main page work fine, but when I click on ULR I have 404 not found. Laravel Valet has nginix - my hosting is apache. Maybe this is problem?
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]
# Fonts
# Add correct content-type for fonts
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg
ExpiresActive On
ExpiresByType image/jpg "access plus 3 month"
ExpiresByType image/jpeg "access plus 3 month"
ExpiresByType image/gif "access plus 3 month"
ExpiresByType image/png "access plus 3 month"
ExpiresByType text/css "access plus 3 month"
ExpiresByType application/pdf "access plus 3 month"
ExpiresByType text/javascript "access plus 3 month"
ExpiresByType application/javascript "access plus 3 month"
ExpiresByType application/x-javascript "access plus 3 month"
ExpiresByType application/x-shockwave-flash "access plus 3 month"
ExpiresByType image/x-icon "access plus 3 month"
ExpiresByType image/ico "access plus 3 month"
ExpiresByType text/css "access plus 3 month"
ExpiresByType text/css "now plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 3 month"
ExpiresByType application/x-font-ttf "access plus 3 month"
ExpiresByType application/x-font-opentype "access plus 3 month"
ExpiresByType application/x-font-woff "access plus 3 month"
ExpiresByType image/svg+xml "access plus 3 month"
ExpiresByType text/html "access plus 600 seconds"
ExpiresDefault "access plus 2 days"
</IfModule>
The issue you're facing is most likely due to the difference in web servers between your local environment (Laravel Valet with Nginx) and your server (Apache). The .htaccess file you provided is specific to Apache and may not work properly with Nginx.
To fix this issue, you can try the following steps:
Remove the existing .htaccess file from your Laravel project.
Create a new file named valet.conf in the root directory of your Laravel project.
Open the valet.conf file and add the following configuration: