CI 框架(Apache环境)有效删除URL中的index.php_html/css_WEB
CI 框架(Apache环境)有效删除URL中的index.php http://www.xuebuyuan.com/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] |