我想在下面的子文件夹中托管我的laravel网站:-
public_html/ecommerce/
实际上,我在public_html中还有一个laravel网站,因为我已将公众从htaccess以下的url网址中删除了
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
但是如果在public_html / ecommerce中添加相同的htaccess,则由于子文件夹的原因,它根本无法正常工作
我在Google上搜索了一些要点,内容如下:-
1) Rename server.php to index.php
2) copy .htacces from public to root
This is working but my all assets path like css jss are not fetching for that i need to add public in each asset link.
有人可以帮我吗,我只能在htccess级别上做什么。预先感谢
答案 0 :(得分:0)
您的目录结构必须为
public_html
中创建.htaccess,即laravel_app1 / .htaccess,laravel_app2 / .htaccess等。在每个.htaccess中添加这样的规则
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php71” package as the default “PHP” programming language.
<IfModule mime_module>
AddType application/x-httpd-ea-php71 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
最后,您可以访问网站yourdomain.com/laravel_app1 yourdomain.com/laravel_app2,依此类推