伪静态怎么配置让子目录必须经过某个index文件,实现分流定向,2个不同的定位方法
展开阅读全文

apache .htaccess nginx

<IfModule mod_rewrite.c>
    Options +FollowSymlinks -Multiviews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]
    #RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
    #RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^so/(.*)$ /so/index.php?rewrite=$1

    RewriteCond % !^$
    RewriteRule ^/?(.*)/.*\.sql - [F]

</IfModule>

windwos IIS

<?xml version="1.0" ?>
<rules>
	<rule name="So_rewrite" stopProcessing="true">
		<match url="^so/(.*)$"/>
		<conditions logicalGrouping="MatchAll">
			<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
			<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
		</conditions>
		<action type="Rewrite" url="/so/index.php?rewrite={R:1}"/>
	</rule>
	<rule name="OrgPage_rewrite" 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>