apache nginx 伪静态

apache

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>


nginx

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

posted @ 2022-07-28 11:07  Bashuslovakia  阅读(87)  评论(0编辑  收藏  举报