简体   繁体   中英

Moving Laravel Project to a Sub Directory

I am a newbie to Laravel.

I want to upload Laravel project from local to shared hosting server.

Scenario is like below: I have a site (abc.com).

I want to deploy Laravel project inside this site so that URL will be like abc.com/xyz

I have moved Laravel project files and folders inside xyz folder.

But site is not running.

What paths needs to change and in which files?

Please help.

它将以abc.com/xyz/public运行

This can be done, but keep in mind that having the Laravel files in your web server root is not recommended.

How you can accomplish abc.com/xyz:

In folder xyz where laravel is installed you can add this in a .htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

Again, this setup is not recommended, because the Laravel files should never be in or above your root.

A better way would probably be to install Laravel in the dir below the root and set xyz as your public directory. You would just have to change the paths in index.php to make sure it searches for the Laravel files below your web root.

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