好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

CI框架(Apache环境)有效删除URL中的index.php_html/css_WEB-ITno

CI 框架(Apache环境)有效删除URL中的index.php

http://HdhCmsTestxuebuyuan测试数据/2172044.html

http://codeigniter.org.cn/forums/thread-15444-1-1.html

index位于根目录时,你可以在index.php所在的根目录里新建.htaccess文件并使用以下 代码:

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

如果需要访问index.php同级目录下的js,css和images,需要在index.php所在的根目录里新建.htaccess文件并使用以下代码:

RewriteEngine OnRewriteCond $1 !^(index\.php|images|js|css|robots\.txt)RewriteRule ^(.*)$ /index.php?/$1 [L] 

当index.php不在根目录时,你可以在index.php所在目录里新建.htaccess文件并使用以下代码:

RewriteEngine onRewriteCond $1 !^(index\.php|images|robots\.txt)RewriteRule ^(.*)$ /path_to_app/index.php?/$1 [L] 

注意把path_to_app换成你的index.php所在文件的目录.假设你的index.php放在根目录的tool子文件夹下,你可以这样写:

RewriteEngine onRewriteCond $1 !^(index\.php|images|robots\.txt)RewriteRule ^(.*)$ /tool/index.php?/$1 [L] 

以上方法在使用facebook第三方登录的时候会无法访问到facebook php sdk的某些文件,需要将.htaccess文件全部重写成以下形式:

RewriteEngine onRewriteRule !\.(js|ico|gif|jpg|png|css|swf|cab|rar|html|pdf|zip|xml|doc|tiff|deb|dmg|exe|tgz|flv|mp4|apk|pkg|mov)$ index.php [NC] php_value upload_max_filesize  300Mphp_value post_max_size        300Mphp_value emax_file_uploads    300php_value gc_maxlifetime  3600*24*30  

查看更多关于CI框架(Apache环境)有效删除URL中的index.php_html/css_WEB-ITno的详细内容...

  阅读:28次