如何删除codeigniter中的index.php(ip地址)

how to remove index.php

http://103.4.217.199/~xxxx/index.php/menu

to

http://103.4.217.199/~xxxx/menu

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

Not working

running from an IP address type URL

** -----------------------**

<ifModule mod_headers.c> Header set Access-Control-Allow-Origin: * </ifModule> RewriteEngine on RewriteBase /~xxxx/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.php|css|js|images|robots\.txt) RewriteRule ^(.*)$ index.php/$1 [L]

Open config.php and do following replacement:

$config['index_page'] = "index.php"

to

$config['index_page'] = ""

In some cases the default setting for uri_protocol does not work properly. Just replace:

$config['uri_protocol'] ="AUTO"

with

$config['uri_protocol'] = "REQUEST_URI"

Then use this in your .htaccess file:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

this is my .htaccess that works on both wamp and live linux server running Centos + Apache and Ubuntu +apache

RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|robots\.txt)
RewriteRule ^(.*)$ /path-to-code-igniter-directory/index.php/$1 [L]

# Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]

I also made a video on how to do this here

https://www.youtube.com/watch?v=v-4VkR54vLU

(skip to 28:50 to see the .htaccess .I also put it in the description under the video)

hope that helps