0

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?

3
  • Do you want that folder response by the rules of Laravel routes? Commented Nov 20, 2018 at 7:33
  • 1
    Hi and welcome to SO. Your posted question does not appear to include any attempt at all to solve the problem. StackOverflow expects you to try to solve your own problem first, as your attempts help us to better understand what you want. Please edit the question to show what you've tried, so as to illustrate a specific problem you're having in a minimal reproducible example. For more information, please see How to Ask and take the Tour. Commented Nov 20, 2018 at 7:51
  • I've not idea how do what I asked, and nothing online help me about it. So.. as last chance I try to call an help to you. Commented Nov 21, 2018 at 8:56

4 Answers 4

1

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>
Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

0

You can just add your folder do_something_here/ in Laravel's public/ folder. Any script placed inside do_something_here/ can be called.

Comments

0

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

Comments

Your Answer

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.