2

私の悪い英語で申し訳ありません...

私は最も基本的な CodeIgniter セットアップを持っていますが、それを機能させることができません... URL http://domain.com/index.php?controllerX/method にアクセスすると、正常に機能します。

http://domain.com/methodにアクセスできるようにしたい

私はデフォルトのコントローラになるようにroutes.php "controllerX"を設定し、次の.htaccessを使用しようとしました:

RewriteEngine on
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]

複数の .htaccess を試しましたが、サーバーが 403 エラーを返すたびに。.htaccess に "RewriteEngine on" という最初の行しか含まれていない場合でも、403 エラーが表示されます。テストのためにすべてのフォルダーをchmod 777または755に設定しようとしましたが、これは何も変わりません。

403 エラーが発生しているリソースを確認する方法はありますか? それとも、他の場所で間違いを犯していますか?

わかりました、htaccessで「Options +FollowSymLink」が必要だとどこかで読みました...サーバーが500エラーを表示します:(

編集 OK、次のhtaccessで機能するようになりました:

Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]
4

2 に答える 2

-1

あなたの質問もここで答えられていると思います

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]


RewriteBase /    
RewriteCond %{HTTP_HOST} !=""
RewriteRule ^index.php(/.*)?$ http://%{HTTP_HOST}$1 [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]
于 2012-10-12T10:09:11.150 に答える