1

I have a problem on my Laravel project using Apache. I am trying to access some network shared folders this way:

$directory = "\\fileserver\public\office\technology";
$items = scandir($directory);

I got this link right here (/office/technology) and it works! Then when I click for a redirect it doesn't work using Apache service (404 Apache error).

I googled some results and I think that's an .htaccess or http-vhosts.conf configuration error.

.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]
 # Send Requests To Front Controller...
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^ index.php [L]
</IfModule>

httpd-vhosts.conf

<VirtualHost *:80>
 ServerName test.vr.it
 DocumentRoot "C:/xampp/htdocs/intranet/public"
 ErrorLog "logs/test.vr.it-error.log"
 <Directory "C:/xampp/htdocs/intranet/public">
 Options FollowSymLinks
 AllowOverride All
 Require all granted
 </Directory>
</VirtualHost>

I also have mod_rewrite enabled but I get 404 error. Can someone help me? Thanks a lot

It works only with php artisan serve command so it's an apache configuration error

asked Apr 24, 2024 at 15:18
7
  • 1
    php artisan serve uses php in the background to have a server, it does not use apache at all. Never use php artisan serve, always use apache or nginx (use Sail if you don't know how to create your own local environment for development using Docker Compose) Commented Apr 24, 2024 at 15:33
  • what about permissions ? like the apache is likely ran as service with different permissions then the php artisan serve which have local user permissions Commented Apr 24, 2024 at 15:46
  • @matiaslauriti im using Apache, I was just saying that the code is correct cause it works with artisan serve Commented Apr 24, 2024 at 21:31
  • @Kazz permissions are good cause I can see the main folders, the problem is I can't get inside the subfolders Commented Apr 24, 2024 at 21:32
  • some ideas? please Commented Apr 30, 2024 at 9:56

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.