开发者

Codeigniter mod rewrite in CentOS

I am trying to set up my project (built in Codeigniter) in Apache/2.0.52 (CentOS) Server.

Everything works perfectly on my local XAMPP server but on the live server, when i try to access pages like myproject.com/agents, it shows

'The requested URL /home/virtual/site777/somefolder/var/www/html/index.php/agents was not found on this server.'

The rewrite rule that I've got at the moment:

RewriteEngine on

RewriteCond $1 !^(assets|favicon\.ico|robots\.txt|index\.php) [NC]

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

I have fo开发者_如何学Pythonllowing settings in my application/config.php file

$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

I would really appreciate if someone could help me.

Thank you!


On my CentOS I only have this:

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

But my site resides in /var/www/html. I am by no means an expert on Apache, but perhaps you need to set the

RewriteBase /home/virtual/site777/somefolder/var/www/html/

As well


Thank you all for viewing and answering my question.

I was able to solve my problem using RewriteBase in htaccess file.


you have to enable url rewriting module of apache.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜