coderones 发表于 2015-12-16 11:41:56

我在nginx 下既隐藏了 url地址中的index.php 同时又能引入 静态资源 css.js等文件。具体配置是           rewrite .*/(statics|uploads)/(.*)$ /$1/$2 last;
       rewrite /.* /index.php break;将css,js等文件放到 statics目录下,并且statics目录和system,application目录是同级别的目录

billyhan 发表于 2016-2-24 18:09:13

我按你的步骤尝试了下,发现好像也不行啊,我也采用的Apache服务器

maczyt 发表于 2016-3-10 14:43:01

赞!!!:victory:

391970172 发表于 2017-4-18 22:24:07

RewriteCond $1 !^(index\.php|images|robots\.txt)这里的静态资源我在view中的文件里引用还是不行,我的静态资源都放在了根目录,必须要用base_url

Garrett 发表于 2017-9-13 16:27:49

Hex 发表于 2008-2-15 13:59
是的,但也需要根据你的目录情况进行修改!
具体你应该看看 apache rewrite 的相关手册!这是 apache 的问 ...

大神 我想问一下为什么我的
RewriteEngine on   
RewriteCond $1 !^(index.php|images|robots.txt)   
RewriteRule ^(.*)$ /index.php/$1
这么写就不行会显示 没有文件
把第三行 改成 RewriteRule ^(.*)$ /index.php?/$1
就可以了想请教一下是什么原因

Hex 发表于 2017-9-14 10:21:02

Garrett 发表于 2017-9-13 16:27
大神 我想问一下为什么我的
RewriteEngine on   
RewriteCond $1 !^(index.php|images|robots.txt)   


你的 codeigniter config 设置的不是 PATH_INFO 吧?

wangyouworld 发表于 2017-9-15 09:06:26

这个是,我用的,根目录下的,.htaccess文件:

# BEGIN CodeIgniter
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ -
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>

# END CodeIgniter

wangyouworld 发表于 2017-9-15 09:06:51

Garrett 发表于 2017-9-13 16:27
大神 我想问一下为什么我的
RewriteEngine on   
RewriteCond $1 !^(index.php|images|robots.txt)   


参见这个:
RewriteRule ^(.*)$ index.php/$1 是什么意思?
https://segmentfault.com/q/1010000009402187/a-1020000009403042

adminadmin 发表于 2017-11-23 10:40:31

大神,可以私聊吗
QQ;402519223
页: 3 4 5 6 7 8 9 10 11 12 [13]
查看完整版本: 去掉 URL 中的 index.php