简体   繁体   English

Laravel 与子域共享主机

[英]Laravel on shared hosting with Subdomain

I Have A shared host and i have made a laravel project and when i upload it to the host i made a htaccess file to redirect all requests to publc/index.php and it works very well and laravel project work good when i create a sub domain and but some files in subdomain's folder and try to access it i got a 500 Internal Server Error when i contaced the support they told me that this error because the .htaccess that i made i need help to solve this problem this is the structure of my public_html folder我有一个共享主机,我做了一个 Laravel 项目,当我将它上传到主机时,我创建了一个 htaccess 文件来将所有请求重定向到 publc/index.php,它运行良好,并且当我创建一个子时,laravel 项目运行良好域和子域文件夹中的一些文件并尝试访问它我收到了一个500 Internal Server Error当我联系支持他们告诉我这个错误是因为我制作的.htaccess我需要帮助来解决这个问题这是结构我的public_html文件夹

-public_html
 |-laravelproject
   |- Laravel Projct Files
 |-subdomain
   |-index.php
 |-.htaccess

.htaccess file: .htaccess 文件:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^laravelproject/public
    RewriteRule ^(.*)$ laravelproject/public/$1 [L]
</IfModule>

Since subdomain is other installation i think you should add由于子域是其他安装,我认为您应该添加

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^laravelproject/public
    RewriteRule ^(.*)$ laravelproject/public/$1 [L]
    RewriteCond %{REQUEST_URI} !^subdomain/public
    RewriteRule ^(.*)$ subdomain/public/$1 [L]
</IfModule>

But im no .htaccess expert, hope it works!...但我不是 .htaccess 专家,希望它有效!...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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