Laravel htaccess的问题 [英] Laravel htaccess issue
问题描述
我想设置一个站点现场。该网站工作完全正常,我们一直在使用它,以显示该网站客户现场开发服务器上。下面是从现场dev目录下的htaccess的(正常工作):
I'm trying to set a site live. The site works perfectly fine on a live dev server which we've been using to show the site to the client. Here is the htaccess from the live dev (works fine):
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
#RewriteCond %{HTTPS} !=on
#RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
#RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Rewrite to 'public' folder
RewriteCond %{HTTP_HOST} ^livedev.domain.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) public/$1 [L]
</IfModule>
AuthType Basic
AuthName "dev16"
AuthUserFile "/home/site/.htpasswds/public_html/passwd"
require valid-user
下面是从活动站点的.htaccess:
And here's the .htaccess from the live site:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
#RewriteCond %{HTTPS} !=on
#RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
#RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Rewrite to 'public' folder
RewriteCond %{HTTP_HOST} ^livesite.co.uk$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) public/$1 [L]
</IfModule>
2的相同,只是HTTP_HOST和除去认证的相同。
The 2 are identical except for the HTTP_HOST and the removal of the authentication.
它给了我一个普通的内部服务器错误。
It gives me a generic "Internal Server Error".
我试图删除的.htaccess这只是给了我找不到页面所以问题肯定在于在.htaccess的内容。
I have tried deleting the contents of .htaccess which just gives me page not found so the issue definitely lies in .htaccess.
有一个总的.htaccess处女,什么步骤我可以找到这个问题的原因是什么?
A total .htaccess virgin, what steps can I take to find the cause of the issue?
感谢
(这是Laravel 3.2.13)
(It's Laravel 3.2.13)
推荐答案
使用AT /同级公
本办法第一重定向到公共
This way first redirect to public
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]
和内部/公共
那么,你处理的index.php
then, you handle index.php
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
这篇关于Laravel htaccess的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!