حذف public از انتهای آدرس پروژه لاراولی در هاست اشتراکی
بعد از انتقال پروژه لاراول به هاست های اشتراکی معمولا آدرس سایت به شکل www.ex.com/public در میاد که حذف اون public آخرش اصلا سخت نیست .
آپدیت خرداد ۱۴۰۱: در روت اصلی پروژه فایل httaccess رو این شکلی تغییر میدیم . همین
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule> # php -- BEGIN cPanel-generated handler, do not edit # Set the “ea-php80” package as the default “PHP” programming language. <IfModule mime_module> AddHandler application/x-httpd-ea-php80 .php .php8 .phtml </IfModule> # php -- END cPanel-generated handler, do not edit
برای این کاریک فایل به نام .htaccess در روت اصلی پروژمون میسازیم و محتوای اون رو به شکل زیر قرار میدیم.
text/x-generic .htaccess ( UTF-8 Unicode English text ) text/x-generic .htaccess ( UTF-8 Unicode text ) <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On RewriteCond %{REQUEST_FILENAME} -d [OR] RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^ ^$1 [N] RewriteCond %{REQUEST_URI} (\.\w+$) [NC] RewriteRule ^(.*)$ public/$1 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ server.php RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </IfModule> # php -- BEGIN cPanel-generated handler, do not edit # Set the “ea-php73” package as the default “PHP” programming language. <IfModule mime_module> AddHandler application/x-httpd-ea-php73 .php .php7 .phtml </IfModule> # php -- END cPanel-generated handler, do not edit