2013-04-11 53 views
10

我试图设置一个网站的生活。该网站在我们用来向客户端显示该网站的实时开发服务器上工作得很好。下面是从现场开发htaccess的(正常工作):Laravel htaccess问题

<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:

<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和去除的相同认证。

它给了我一个通用的“内部服务器错误”。

我已经尝试删除.htaccess的内容,它只是给我找不到页面,所以问题肯定存在于.htaccess中。

总共.htaccess处女,我可以采取哪些步骤来找出问题的原因?

感谢

(这是Laravel 3.2.13)在同一水平

+1

'Options + FollowSymlinks'要求'AllowOverride'设置为'Options'或更高权限。删除该行然后告诉我们发生了什么事。 – 2013-04-11 10:30:03

+0

当我删除那条线我刚刚得到一个404 – Fraser 2013-04-11 10:38:08

+0

这更好。它比以前少了96!检查Apache的错误日志,看看哪个文件被映射。 – 2013-04-11 10:41:12

回答

7

使用/公共

这样第一重定向到公共

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

<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> 
+0

在index.php为我工作之前添加一个斜线。 RewriteRule ^(。*)$ /index.php/$1 [L] – 2013-10-25 16:51:34

0

我有完全相同的设置为RamiroRS answer,但仍然得到了内部服务器错误。我的问题是文件权限。文件夹应该是0755和文件0644.