APACHE: php
在apache下去掉url上的index.php折腾了很久 ,一直是访问css ,js,图片文件 you can't access files on server 之类的错误提示,apached的配置上说的是 css
把 AllowOverride none 改为 AllowOverride All ,而后allow from all,一直不生效,能够跳转页面,可是样式,js文件,图片都丢失, html
发现仍是.htaccss的RewriteCond出现了问题,原来是目录不对。 web
原先的样式文件,图片文件,js文件都放在application/views/templates下面了,后来改为一个和application同级的assets下面,如图: apache
<IfModule mod_rewrite.c> app
RewriteEngine On ide
RewriteBase / url
RewriteCond $1 !^(index\.php|assets|system|robots\.txt) spa
RewriteRule ^(.*)$ /index.php/$1 [L,QSA] server
</IfModule>
apache配置文件
<VirtualHost *:80>
ServerAdmin major2000@sina.com
DocumentRoot "d:/wnmp/web/myproject"
ServerName www.key.local
<Directory "d:/wnmp/web/myproject"> // 这里是项目的目录
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
NGINX里这样配置
location / {
root D:/wnmp/web/myproject/; index index.php index.html index.htm; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?$1 last; break; } }