# quickwebp/3.3.1/admin/rewrite-rules/class-nginx.php

QuickWebP – WebP &amp; AVIF Image Optimizer, Compression &amp; SEO for WordPress, version 3.3.1. 49 lines.

- Page: https://pluginprobe.com/plugins/quickwebp/3.3.1/code/admin/rewrite-rules/class-nginx.php
- Raw: https://pluginprobe.com/plugins/quickwebp/3.3.1/raw/admin/rewrite-rules/class-nginx.php
- Modified: 2025-12-26T15:36:44+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/quickwebp/3.3.1/code/admin/rewrite-rules/class-nginx.php#L10-L20`.

```php
<?php

include_once QUICKWEBP_PLUGIN_PATH . 'admin/rewrite-rules/class-rewrite-rules-abstract.php';

class Nginx extends Rewrite_Rules_Abstract {

	/**
	 * Get the path to the file.
	 */
	protected function get_file_path() {
		$file_path = $this->get_site_root() . 'conf/quickwebp.conf';

		return $file_path;
	}

    /**
	 * Get unfiltered new contents to write into the file.
	 *
	 * @since  1.9
	 * @access protected
	 * @author Grégory Viguier
	 *
	 * @return string
	 */
	protected function get_raw_new_contents() {
        $extensions = 'jpg|jpeg|jpe|png';
		$home_root  = wp_parse_url( home_url( '/' ) );
		$home_root  = $home_root['path'];

		return trim( '
# BEGIN ' . $this->tag_name . '
location ~* ^(' . $home_root . '.+)\.(' . $extensions . ')$ {
	add_header Vary Accept;

	if ($http_accept ~* "webp"){
		set $imwebp A;
	}
	if (-f $request_filename.webp) {
		set $imwebp  "${imwebp}B";
	}
	if ($imwebp = AB) {
		rewrite ^(.*) $1.webp;
	}
}
# END ' . $this->tag_name . '');
	}


}
```
