CodeIgniter的伪静态配置
程序员文章站
2024-02-12 12:40:46
...
基本信息
- CodeIgniter 版本:3.1.8
- Nginx: Tengine/2.1.2 (nginx/1.6.2)
- MySQL: Ver 14.14 Distrib 5.6.33, for Linux (x86_64) using EditLine wrapper
- PHP: 5.6.30
- Zend Engine : v2.6.0
- CentOS release 6.8 (Final)
Nginx
server {
listen 80;
server_name yml.nnkh1314.com;
root "/disk/www/yml_nnkh1314_com";
index index.php index.html index.htm;
location / {
# 这里使用try_files进行url重写,不用rewrite了。
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php($|/) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Apache
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
IIS
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Index">
<match url="^(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Godaddy
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^index.php/(.*)$ [L]
转载于:https://my.oschina.net/u/616147/blog/1802798