我創建了一個CodeIgniter應用程序,現在我試圖用index.php將urls重定向到沒有它的url。在CodeIgniter中重定向index.php
我目前的.htaccess是:
RewriteEngine On
RewriteBase/
# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]
# Enforce www
# If you have subdomains, you can add them to
# the list using the "|" (OR) regex operator
RewriteCond %{HTTP_HOST} !^(www|subdomain) [NC]
RewriteRule ^(.*)$ http://www.plugb.com/$1 [L,R=301]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
唯一的問題是,在同一個頁面被訪問使用和不使用的index.php。
例如:
http://www.plugb.com/index.php/games/adventure-rpg
和
http://www.plugb.com/games/adventure-rpg
有沒有辦法來重定向的index.php網址嗎?
謝謝, 加布裏埃爾。
我沒有得到它。 你想從URL中刪除index.php嗎? – ronaldosantana 2010-05-18 22:50:17
@Ronaldo Junior是的。 – 2010-05-18 22:53:56