简体   繁体   中英

How to redirect user to public/ directory in PHP Composer?

This is how my file structure is:

./ git
./ public
      ./assets/
      ./pages/
      ./index.php
./tests
./vendor
./composer.json
./composer.lock

./index.php ==> header('Location: /public/'); Should I do this ?

Instead of typing stories.com/public in my browser eveytime, should I include an index.php and then use header call or is there any other * better * method ?

Please keep in mind I want to later on deploy my app to HEROKU for FREE

You should just set the document root folder to be your public folder.

This is from the FAQ: https://devcenter.heroku.com/articles/custom-php-settings#setting-the-document-root

For example, if you're using Apache with PHP, and you'd like your document root to be set to the public sub-directory of your application (because that's where your index.php and all images, CSS and JavaScript reside), your Procfile would look like this:

web: vendor/bin/heroku-php-apache2 public/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM