开发者

CodeIgniter URL rewriting problem

So basically I have the same problem described here and there. I tried everything described (and much more...), but anyway. Here is my .htaccess :

RewriteEngine on

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

I tried various things, like adding a "/" before the "index.php" or without the "?" after the "index.php", but it didn't change anything.

We have exactly the same file in the development environment, but when moving to production, I just can't get the index.php to disappear. The only difference between the two environment are their location on their respective server (.../public_html/APP versus .../public_html/sub-domains-name/APP), I don't think it's related, but I already had some problems with CI when moving the开发者_如何学Go application around, so maybe there's something there.

Oh and finally, here are the related line in the config.php :

$config['base_url'] = "http://www.domain.com/";
$config['index_page'] ='';
$config['uri_protocol'] = "AUTO";

EDIT Also, since the production and development environment are on the same server, I already ruled out the possibility of a configuration problem on behalf of apache.

EDIT2 I tried to create a sub-directory on the production server and migrated the website there (www.domain.com/test/). Everything work fine like this... So there's definitely a configuration parameter I'm missing somwhere.


I use the same rewrite rule in my application. Try this: Change

$config['uri_protocol'] = "AUTO";

to become

$config['uri_protocol'] = "QUERY_STRING";

It's working well in mine.

Try to dive the apache access log and error log, to find out where the browser request is routed by apache and how your CI get that request. Activating log in CI helps too:

$config['log_threshold'] = 2;

Don't forget to set appropiate permission to system/logs directory, so apache can write log file to it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜