Laravel routing - relative path problems

I have a directory structure like this:

docs
  - index.php
  - js/
  - css/
  - img/
mylaravelapp
  - app/
  - bootstrap/
  - config/
  - database/
  - public/
  - resources/
  - storage/
  - tests/
  - etc.

      

What I want is that when the user navigates to:

http: // localhost / myprojects / mylaravelapp / public / docs

They get all files from my "docs" folder (including all javascript, css and images ...)

I tried:

  • placing a symbolic link to .. /../docs inside a "public" folder (does not work - I get the message "Sorry, the page you are looking for could not be found").
  • .htaccess such as RewriteRule ^docs/(.*) {REQUEST_FILENAME}/../../docs/$1 [L]

    , but I'm afraid here ...

Can I do this somehow in routes.php? I think all of this in my routes.php file will suit me best.

Something like:

Route::get('docs', 'DocsController@index');

But how do you get a link back to a folder not in the public directory?

I'm really new to Laravel, so please take it easy ...

+3


source to share


1 answer


Why are you making the "docs" folder outside of your application?

In this situation, if you have a "docs" directory outside of "mylaravelapp", then your link will look like this:



http: // localhost / myprojects / docs

but I think this is not a good architectural solution

+2


source







All Articles