Salman Hameed
Salman Hameed

Reputation: 1

Php laravel route.php does not work on a specific call

My site's directory structure is;

site -> app -> public --> soundfiles (directory having sounds files)

route.php: Route::get("soundfiles", "controller@soundfiles");

when I hit mysite/soundfiles it shows me soudfiles directory instead of going to => controller@soundfiles.

I want it does not show sound files. where is the problem.

Upvotes: 0

Views: 48

Answers (2)

V16
V16

Reputation: 119

You should try:

Route::get("/soundfiles", "soundfilescontroller@soundfiles");

Route::get('/urlalias', 'controllerName@functionName');

OR

Add this to your htaccess file

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

Upvotes: 1

Dwight
Dwight

Reputation: 12460

Your web server is serving the directory instead of routing everything through index.php. Work out whether you're using Nginx or Apache and ensure you've got it configured correctly. Laravel ships with a valid .htaccess file for Apache, read the docs for how to configure Nginx.

Upvotes: 0

Related Questions