2015-06-18 34 views
0

如何删除的index.php如何codeigntier删除的index.php(IP地址)

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

http://103.4.217.199/~xxxx/menu

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

不工作

+0

这已经问了几次堆栈溢出http://stackoverflow.com/search?q=how+to+remove+index.php+from+url+codeigniter – user4419336

+0

可能的重复[删除index.php从URL - Codeigniter 2](http://stackoverflow.com/questions/5155333/remove-index-php-from-url-codeigniter-2) –

+0

这些.htaccess可能能够帮助你https:/ /github.com/riwakawebsitedesigns/htaccess_for_codeigniter – user4419336

回答

0

从一个IP地址类型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]

1

开放config.php并做下列更换T:

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

$config['index_page'] = "" 

在某些情况下,uri_protocol默认设置无法正常工作。只需更换:

$config['uri_protocol'] ="AUTO" 

$config['uri_protocol'] = "REQUEST_URI" 

然后在您.htaccess文件中使用此:

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

请投票并接受我的答案,如果有帮助。 –

+0

谢谢我,但不工作 可以删除案件ip号码index.php? 我不知道是不是 –

+0

尝试使用RewriteRule ^(。*)$ ./index.php/$1 [L,QSA]这是最后一行htaccess代码 –

0

这是我的.htaccess,工程运行的Centos + Apache和Ubuntu的+ APACHE两个WAMP和生活中的Linux服务器上

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] 

我还就如何做到这一点这里

视频

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

(跳到28:50看到的.htaccess。我也把它描述中的视频下)

希望有帮助