拟静态设置 Rewrite URL

根据服务器的类型有所区别:

1) linux/unix 使用 .htaccess文件,文件内容

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1

2) windows使用 httpd.ini文件

[ISAPI_Rewrite]

3600 = 1 hour

CacheClockRate 3600
RepeatLimit 32

RewriteRule .*.(?:gif|jpg|png|css|js|txt|jpeg|svg|ico|woff|ttf|swf|flv) $0 [I,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

#
RewriteRule ^(?!/index.html)(?!/index.php)(?!/callback.php)(?!/wx)(?!/Public)(?!/wb)(.*)$ /index.php/$1 [L]

不匹配.gif, .jpg等文件,不匹配 wx、Public等文件夹

0%