Home

Yaf 框架 nginx 与 apache 重写

nginx 重写

location / {
    try_files $uri $uri/ /index.html$is_args$args;
}


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

htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !(\.(ico|gif|jpg|png|bmp|swf|css|js))
RewriteRule ^api(.*)$ index.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !(\.(ico|gif|jpg|png|bmp|swf|css|js))
RewriteRule ^(.*)$ index.html [L]