Skip to main content
deleted 26 characters in body
Source Link
TylerH
  • 21.3k
  • 84
  • 84
  • 121


PLEASE NOTE when serving a Laravel project with Docker: you won't need to do any of this. Only use this option when your root (or more commonly: public_html) directory of your website is your Laravel project (this is not the case when you're using Docker).

DON'T!

YOU REALLY SHOULD NOT rename server.php in your Laravel root folder to index.php and copy the .htaccess file from the /public directory to your Laravel root folder!!!

This way everyone can access some of your files (.env for example). Try it yourself. You don't want that!


DO

Instead, you should create an .htaccess file in your root like this:

RewriteEngine On RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L,QSA] 

This will silently rewrite all your base URIs to the /public folder. Even all Headers, for example the HTTP Authorization Header, and all optional URI parameters will silently be passed on to the /public folder as well.

That's all



PLEASE NOTE when serving a Laravel project with Docker: you won't need to do any of this. Only use this option when your root (or more commonly: public_html) directory of your website is your Laravel project (this is not the case when you're using Docker).

DON'T!

YOU REALLY SHOULD NOT rename server.php in your Laravel root folder to index.php and copy the .htaccess file from the /public directory to your Laravel root folder!!!

This way everyone can access some of your files (.env for example). Try it yourself. You don't want that!


DO

Instead, you should create an .htaccess file in your root like this:

RewriteEngine On RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L,QSA] 

This will silently rewrite all your base URIs to the /public folder. Even all Headers, for example the HTTP Authorization Header, and all optional URI parameters will silently be passed on to the /public folder as well.

That's all



PLEASE NOTE when serving a Laravel project with Docker: you won't need to do any of this. Only use this option when your root (or more commonly: public_html) directory of your website is your Laravel project (this is not the case when you're using Docker).

DON'T!

YOU REALLY SHOULD NOT rename server.php in your Laravel root folder to index.php and copy the .htaccess file from the /public directory to your Laravel root folder!!!

This way everyone can access some of your files (.env for example). Try it yourself. You don't want that!


DO

Instead, you should create an .htaccess file in your root like this:

RewriteEngine On RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L,QSA] 

This will silently rewrite all your base URIs to the /public folder. Even all Headers, for example the HTTP Authorization Header, and all optional URI parameters will silently be passed on to the /public folder as well.

docker and dont need to do this
Source Link
Derk Jan Speelman
  • 12.1k
  • 4
  • 32
  • 48


Please notePLEASE NOTE when serving a Laravel project with Docker and/or Node: you won't need to do any of this. Only use this option when serving Laravel with php directly from your project root (or more commonly: public_html) directory of your website is your Laravel project (this is not the case when you're using Docker).

DON'T!

YOU REALLY SHOULD NOT rename server.php in your Laravel root folder to index.php and copy the .htaccess file from the /public directory to your Laravel root folder!!!

This way everyone can access some of your files (.env for example). Try it yourself. You don't want that!


DO

Instead, you should create an .htaccess file in your root like this:

RewriteEngine On RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L,QSA] 

This will silently rewrite all your base URIs to the /public folder. Even all Headers, for example the HTTP Authorization Header, and all optional URI parameters will silently be passed on to the /public folder as well.

That's all

Please note when setting up a Laravel project with Docker: you won't need to do any of this.




Please note when serving a Laravel project with Docker and/or Node: you won't need to do any of this. Only use this option when serving Laravel with php directly from your project root directory.

DON'T!

YOU REALLY SHOULD NOT rename server.php in your Laravel root folder to index.php and copy the .htaccess file from the /public directory to your Laravel root folder!!!

This way everyone can access some of your files (.env for example). Try it yourself. You don't want that!


DO

Instead, you should create an .htaccess file in your root like this:

RewriteEngine On RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L,QSA] 

This will silently rewrite all your base URIs to the /public folder. Even all Headers, for example the HTTP Authorization Header, and all optional URI parameters will silently be passed on to the /public folder as well.

That's all

Please note when setting up a Laravel project with Docker: you won't need to do any of this.




PLEASE NOTE when serving a Laravel project with Docker: you won't need to do any of this. Only use this option when your root (or more commonly: public_html) directory of your website is your Laravel project (this is not the case when you're using Docker).

DON'T!

YOU REALLY SHOULD NOT rename server.php in your Laravel root folder to index.php and copy the .htaccess file from the /public directory to your Laravel root folder!!!

This way everyone can access some of your files (.env for example). Try it yourself. You don't want that!


DO

Instead, you should create an .htaccess file in your root like this:

RewriteEngine On RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L,QSA] 

This will silently rewrite all your base URIs to the /public folder. Even all Headers, for example the HTTP Authorization Header, and all optional URI parameters will silently be passed on to the /public folder as well.

That's all

docker and js frameworks dont need to do this
Source Link
Derk Jan Speelman
  • 12.1k
  • 4
  • 32
  • 48


Please note when setting upserving a Laravel project with Docker and/or Node: you won't need to do any of this. Only use this option when serving Laravel with php directly from your project root directory.

DON'T!

YOU REALLY SHOULD NOT rename server.php in your Laravel root folder to index.php and copy the .htaccess file from the /public directory to your Laravel root folder!!!

This way everyone can access some of your files (.env for example). Try it yourself. You don't want that!


DO

Instead, you should create an .htaccess file in your root like this:

RewriteEngine On RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L,QSA] 

This will silently rewrite all your base URIs to the /public folder. Even all Headers, for example the HTTP Authorization Header, and all optional URI parameters will silently be passed on to the /public folder as well.

That's all

Please note when setting up a Laravel project with Docker: you won't need to do any of this.




Please note when setting up a Laravel project with Docker: you won't need to do any of this.

DON'T!

YOU REALLY SHOULD NOT rename server.php in your Laravel root folder to index.php and copy the .htaccess file from the /public directory to your Laravel root folder!!!

This way everyone can access some of your files (.env for example). Try it yourself. You don't want that!


DO

Instead, you should create an .htaccess file in your root like this:

RewriteEngine On RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L,QSA] 

This will silently rewrite all your base URIs to the /public folder. Even all Headers, for example the HTTP Authorization Header, and all optional URI parameters will silently be passed on to the /public folder as well.

That's all

Please note when setting up a Laravel project with Docker: you won't need to do any of this.




Please note when serving a Laravel project with Docker and/or Node: you won't need to do any of this. Only use this option when serving Laravel with php directly from your project root directory.

DON'T!

YOU REALLY SHOULD NOT rename server.php in your Laravel root folder to index.php and copy the .htaccess file from the /public directory to your Laravel root folder!!!

This way everyone can access some of your files (.env for example). Try it yourself. You don't want that!


DO

Instead, you should create an .htaccess file in your root like this:

RewriteEngine On RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L,QSA] 

This will silently rewrite all your base URIs to the /public folder. Even all Headers, for example the HTTP Authorization Header, and all optional URI parameters will silently be passed on to the /public folder as well.

That's all

Please note when setting up a Laravel project with Docker: you won't need to do any of this.


enhance the note
Source Link
Derk Jan Speelman
  • 12.1k
  • 4
  • 32
  • 48
Loading
added 7 characters in body
Source Link
Derk Jan Speelman
  • 12.1k
  • 4
  • 32
  • 48
Loading
added 89 characters in body
Source Link
Derk Jan Speelman
  • 12.1k
  • 4
  • 32
  • 48
Loading
deleted 946 characters in body
Source Link
Derk Jan Speelman
  • 12.1k
  • 4
  • 32
  • 48
Loading
added 708 characters in body
Source Link
Derk Jan Speelman
  • 12.1k
  • 4
  • 32
  • 48
Loading
better explination
Source Link
Derk Jan Speelman
  • 12.1k
  • 4
  • 32
  • 48
Loading
added 192 characters in body
Source Link
Derk Jan Speelman
  • 12.1k
  • 4
  • 32
  • 48
Loading
added 3 characters in body
Source Link
Derk Jan Speelman
  • 12.1k
  • 4
  • 32
  • 48
Loading
added 14 characters in body
Source Link
Derk Jan Speelman
  • 12.1k
  • 4
  • 32
  • 48
Loading
added 13 characters in body
Source Link
Derk Jan Speelman
  • 12.1k
  • 4
  • 32
  • 48
Loading
Source Link
Derk Jan Speelman
  • 12.1k
  • 4
  • 32
  • 48
Loading