关小开

技术,思考

nginx / apache 配置 codeigniter 去掉 index.php

服务器 评论已关闭

nginx

location / {
   if (!-e $request_filename) {
      rewrite ^/(.*)$ /index.php/$1 last;
   }  
}
location /m/ {
   if (!-e $request_filename) {
      rewrite ^/(.*)$ /m/index.php/$1 last;
   }  
}

apache

RewriteEngine on
RewriteCond $1 !^(index.php|js|css|image|robots.txt|favicon.ico)
RewriteRule ^(.*)$ index.php/$1 [L]

RewriteEngine on
RewriteCond $1 !^(index.php|js|css|image|robots.txt|favicon.ico)
RewriteRule ^(.*)$ /m/index.php/$1 [L]

因为要用到ssl,还是比较喜欢nginx。

上一篇

评论已关闭。