Skip to content
Advertisement

Vanilla php files in subfolder with laravel – page not found error

I have a laravel app: https://laravel-app.com

I want to serve custom pages from a folder on the same domain https:laravel-app.com/player/player.php

I have set the .htaccess file

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /player/
  RewriteRule ^index.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /player/player.php [L]
</IfModule>

But when I try and navigate to that page by using this direct url: https:laravel-app.com/player/player.php

I get the laravel routing error: sorry, the page could not be found

Can someone explain how to get around this?

Advertisement

Answer

Anything you want accessible you can put in the public folder of your application, which should be the DocRoot/WebRoot. You won’t need any special rewriting or rules as it will be an existing file so the server will serve it fine.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement