0

今の私のhtaccess:

# Use PHP 5.3
AddType application/x-httpd-php53 .php


RewriteEngine On
RewriteBase /

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#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]

# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin

ErrorDocument 404 /index.php

誰かが入力した場合、ルールを実行する必要がありますhttp://www.mypage.com/blog/blablatitle

それは彼をにリダイレクトしますhttp://mypage.com/blog/blablatitle

フロントページとすべてのページで同じです。

CodeIgniter を使用していますが、htaccess を扱う場合には、これはそれほど重要ではないと思います。

この提案された解決策は、CodeIgniter ではうまく機能しません。

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

アドレスに index.php を追加するため、例: 入力すると:

http://www.mypage.com/blog/blablatitle

それは私をリダイレクトします:

http://mypage.com/index.php?/blog/blablatitle

そして、私は必要です:

http://mypage.com/blog/blablatitle

このルールがなくても問題ありません (インデックス、php なし) 例:http://mypage.com/blog/blablatitle

では、リダイレクトされたリンクに index.php が表示されないため、このリダイレクト ルールを改善するためのアドバイスはありますか?

4

2 に答える 2

1

解決しました!;) 直後に置く必要があります

RewriteBase /
于 2012-12-06T11:15:55.090 に答える
1

これを試してください:

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]

RewriteRule ^index.php(.*)$ http://%1/$1 [R=301,L]

于 2012-12-06T11:17:21.207 に答える