2013-06-20 50 views
1

試圖讓笨重定向解決方案

www.example.com/home 

直接去

www.example.com/ 

我已經試過:

Options +FollowSymlinks 
RewriteEngine on 

RewriteCond %{HTTP_HOST} ^example.com$ 
RewriteRule (.*) http://www.example.com/$1 [R=301,L] 

RewriteCond %{HTTP_HOST} ^(.+)\www.example\.com$ 
RewriteRule ^/(.*)$ /samle/%1/$1 [L] 

我在做什麼錯?

但它的網站總是在旋轉。

Redirect 301 /home http://www.example.com/ 
+0

''redirect()'沒有'params'會做 – tomexsans

+0

不能讓你請 – Karthiga

回答

0

如果你說的是,你想在你的「家」控制器是默認主頁索引功能,您可以設置在routes.php文件的路徑[「default_controller」]參數下。這樣你根本不用擔心重定向。如果你想在任何時候輸入/ home,就可以使用mod-rewrite,就像你從uri中移除index.php一樣。查看文檔以獲得更多信息http://ellislab.com/codeigniter/user-guide/general/urls.html