我有共享托管的laravel项目,我的结构应用程序是
/home/username `->fontEndApps ( my laravel apps )` `->backendApps ( my laravel apps )` `->public_html`
在公共html我把index.PHP,htaccess和admin文件夹,在admin文件夹中有index.PHP和htaccess
后端工作正常,但是当我尝试访问www.domain.com/segment1或www.domain.com/segment1/segment2时前端我总是得到500个内部服务器错误,这是我的前端和后端的htaccess文件
<IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options +FollowSymLinks </IfModule> RewriteEngine On # Redirect Trailing Slashes... RewriteRule ^(.*)/$/$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.PHP [L] </IfModule>
请帮我弄清楚这个问题
你的问题是.htaccess文件.在goDaddy中,他们不会设置RewriteBase,因此您必须在.htaccess文件中提供它.完整的代码是这样的.这与我的laravel组合
site一起使用
<Limit GET POST PUT DELETE> #For REST support Allow from all </Limit> <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On RewriteBase / # <------------ This one you missed #Just to redirect to www.site.com when only site.com comes RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$http://www.%{HTTP_HOST} [R=301,L] #end of codes # Redirect Trailing Slashes... RewriteRule ^(.*)/$/$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.PHP [L] </IfModule>