2015-06-17 35 views
2

這是.htaccess文件現在Laravel 4個htaccess的重定向循環2

<IfModule mod_rewrite.c> 
    <IfModule mod_negotiation.c> 
    Options -MultiViews 
    </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] 

,但我想改變這個文件時請求來自blog.domain.com重定向到/博客文件夾和其他文件在index.php

+1

那麼你是如何使用所造成的循環? –

+0

當我更改網址到/博客 –

回答

1

試試這個:

RewriteEngine On 
#Redirecting blog.example.com to blog folder 
RewriteCond %{HTTP_HOST} ^blog.example.com$ [NC] 
RewriteRule ^(.*)/?$ /blog/$1 [L,NC] 

#Redirect other requests to index.php 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule^/index.php [L,NC] 
+0

它是否工作,當我把「/」它返回我的公共文件夾 –

+1

你是什麼意思「當我把/」? – starkeen

+0

其實我也想訪問公共文件夾。 –