Skip to main content
Docs menu

filter · CSS filters

Fallback CSS URL rewriting (fallback_rewrite_css_urls)

Category:
CSS
CoreFilters:
Yes
OptimizeForBandwidth:
No
Risk:
Generally safe

Rewrites resource URLs embedded in CSS files even when CSS parsing fails. Acts as a safety net for non-standard CSS that the full parser cannot handle.

When to use it

  • In CoreFilters, the default RewriteLevel: it runs unless you disable it.
  • Risk rating on these docs: Generally safe.

Risks

The CSS filters page lists no specific risks for this filter. If a page misbehaves with it, DisableFilters fallback_rewrite_css_urls turns it off for the scope you set it in.

Configuration

Enable it in the module configuration, at server, virtual-host or location scope:

Apache

ModPagespeedEnableFilters fallback_rewrite_css_urls

nginx

pagespeed EnableFilters fallback_rewrite_css_urls;

IIS (pagespeed.config)

pagespeed EnableFilters fallback_rewrite_css_urls

It is on by default under CoreFilters; to turn it off:

ModPagespeedDisableFilters fallback_rewrite_css_urls   # Apache
pagespeed DisableFilters fallback_rewrite_css_urls;   # nginx
pagespeed DisableFilters fallback_rewrite_css_urls   # IIS

Scoping, ForbidFilters and the thresholds filters read: Choosing filters.

Live example

Rewrites URLs inside CSS even when the stylesheet cannot be fully parsed.

In the example's capture the HTML document grows from 470 B to 530 B, and the total weight (HTML plus the files it loads) rises from 633 B to 782 B, 24% larger, so the example shows a source diff rather than a byte or request reduction.

See the before and after, with the source diff →

Frequently asked questions

What does the fallback_rewrite_css_urls filter do?
Rewrites resource URLs embedded in CSS files even when CSS parsing fails. Acts as a safety net for non-standard CSS that the full parser cannot handle.
Is fallback_rewrite_css_urls enabled by default?
Yes. fallback_rewrite_css_urls is in CoreFilters, the default RewriteLevel, so it runs unless you turn it off with DisableFilters.
How do I turn off fallback_rewrite_css_urls?
Add ModPagespeedDisableFilters fallback_rewrite_css_urls on Apache or pagespeed DisableFilters fallback_rewrite_css_urls; on nginx. On IIS, add pagespeed DisableFilters fallback_rewrite_css_urls to pagespeed.config.

This page is drawn from the fallback_rewrite_css_urls entry on CSS filters. Every filter in one table: PageSpeed filters.

Search