Reputation: 150
I need to put in my domain directories a simple php script that have to run isolated from the rest of my laravel application.
For example if my Laravel app run on www.example.com
.
If I call www.example.com/do_something_here/
and this do_something_here
is a subfolder of my project that do not respond by the rules of Laravel routes.
Is it possible?
Upvotes: 0
Views: 81
Reputation: 1570
The way I handle this is to use routes, catch all for any other page.
Routes
Route::get('functionName/{slugFolderName}/{slugFileName}', [
'uses' => 'PageController@getPage'
])->where('slug', '([A-Za-z0-9-/]+)');
This will match slugs like
test-page/sub-page
another-page/sub-page
Controller
public function getPage($slugFolderName,$slugFileName){
return view($slugFolderName.$slugFileName);
}
Hope this structure will help you
Upvotes: 0
Reputation: 2855
For you situation if your folder in public directory then (folder name should be: do_something_here)
change your .htaccess file for permission to access the folder. so that user can direct view your folder
Example:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Upvotes: 1
Reputation:
You can just add your folder do_something_here/
in Laravel's public/
folder. Any script placed inside do_something_here/
can be called.
Upvotes: 0
Reputation: 11481
You can do it. Whatever request comes to your site, it will hit your index.php
. Present inside the public/
directory and then the routing, classloading processes happens.
You might want to add some rules there in the index.php
(you can write it just after the <?php
line.) before the application bootstrapping happens, by checking the request URL, ($_REQUEST
) and execute specific scripts and return.
One other way is to add rules in the .htaccess
file if it's enabled. a quick google will find you way
Upvotes: 1