php配置僞靜態如何將.htaccess文件轉換 nginx僞靜態文件

  php一般設置僞靜態三種狀況,.htaccess文件,nginx僞靜態文件,Web.Config文件得形式,如何將三種僞靜態應用到項目中呢,php

1,.htaccess文件 實例html

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine Onnginx

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
RewriteCond %{http_host} ^96net.com.cn [NC]
RewriteRule ^(.*)$ http://www.96net.com.cn/$1 [L,R=301]
</IfModule>web

2, nginx僞靜態文件實例url

server {
listen 80;
server_name v1.ywwfx.com;
root /home/www/v1.ywwfx.com;server

#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
xml

location / {
index index.php index.html index.htm;
if (!-e $request_filename) {
     rewrite ^/(.*)$ /index.php?s=$1 last; #隱藏index.php
}
}htm

}input

3,Web.Config文件it

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="OrgPage" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^(.*)$" />
<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>

在項目應用得過程當中,必定要看清楚好項目運行得環境。

相關文章
相關標籤/搜索