MYのCodeIgnitor設定では、ベースURLが期待できるURLで404が返されますhttp://x.example.com/test/)。 CodeIgniterが/index.php/をすべてのURLに追加するのはなぜですか?
要求されたURL /index.php/foobar/177
が見つかりませんこのサーバー上で見つかりませんでした:私は、URLなどのhttp://x.example.com/test/foobar/177を訪問しようとすると、私は以下の404を得ます。
私は(これはWebfactionである)私のWebサーバーのログを確認すると、それだけで言う:
[月3月19日午前12時23分45秒2012] [エラー] [クライアント12.34.56.78]ファイルがありませんない が存在する:
/var/www/html/no_app_on_root.htmlindex.phpファイルパスは、index.phpので連結されていること方法はありません、奇妙なのですか?ここで
は私の.htaccessです:
Options +FollowSymLinks
# Set which file that's fetched if only directory is specified
DirectoryIndex index.php index.html index.htm
# don't list category structures
Options -Indexes
# don't display .htaccess files
<Files .htaccess>
order allow,deny
deny from all
</Files>
<IfModule mod_rewrite.c>
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
#This last condition enables access to the images and css folders, and the robots.txt file
#Submitted by Michael Radlmaier (mradlmaier)
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# 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
</IfModule>
私のroutes.php:
$route['default_controller'] = "home";
$route['404_override'] = '';
$route['foobar/177'] = "foobar/foobar_177";
$route['foobar/:num/add'] = "foobar/add";
$route['foobar/:num/review'] = "foobar/review";
$route['foobar/:num'] = "foobar";
私のconfig.php(はい、サイトはサブドメイン上のディレクトリにある):
$config['base_url'] = 'http://x.example.com/test/';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
お試しください。http://stackoverflow.com/questions/9455757/how-can-i-avoid-index-php-from-url-in-codelgniter/9455829#9455829 –