简介:IIS 环境下php 如何配置伪静态规则
前言
提示:这里可以添加本文要记录的大概内容:
例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。
提示:以下是本篇文章正文内容,下面案例可供参考
一、Apache服务器.htaccess伪静态设置
RewriteEngine on
RewriteCond $1 !^(index\\.php|system\\.php|images|skin|js|ls|swfupload|attachment|application|robots\\.txt)
RewriteRule ^(.*)$ /fx/index.php/$1 [L]
或者第二种
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?id=$1
</IfModule>
二、Nginx服务器伪静态设置
location / {
root /var/www/html/;
index index.html index.htm index.php;
if ($request_filename !~* /(js|css|img|uploads|resources|robots\.txt|index\.php)) {
rewrite ^/(.*)$ /index.php?$1 last;
}
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
三、IIS服务器web.config伪静态设置
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^/(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{R:1}" pattern="^(index\.php|images|styles|scripts|uploads|resources|robots\.txt)" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="/index.php/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
三、httd.ini伪静态设置
RewriteRule ^/(?:images|styles|scripts|uploads|resources)/(.*) $0 [L]
RewriteRule ^/(.*)$ /$1/index.php/$2 [L]