Rewrite Rules for Apache, IIS, & NGINX
A compendium of common and uncommon rewrite rules for everyday use
Popular in Apache
- Add/Remove Trailing Slash (Apache) Add or remove the trailing slash in URLs to enforce consistent URL structure, good for SEO.
- Canonicalize Host – Add/Remove www (Apache) Canonicalize host names by either prepending www or explicitly omitting it from the domain name.
- Enable GZip/DEFLATE Compression (Apache) Enable compressed responses using GZip or Deflate to reduce bandwidth and increase performance.
- Enforce Lower Case URLs (Apache) Force lowercase URLs, especially important for SEO on Windows-based servers, which are case-insensitive.
- Block Specific User-agents (Apache) Block specific User-agents' requests. Useful for dealing with malicious bots.
- Rewrite URL as Query String Parameters (Apache) Convert URL structure to query string parameters. Use to create SEO friendly URLs.
- Add Caching for Static Assets (Apache) Add caching directives that browsers will use to cache static assets on the client side.
- Prevent Image Hotlinking (Apache) Stop other sites from using your images as their own.
- Deny Request Based On Method (Apache) Block requests when made with specific request methods.
- Redirect All HTTP Requests To HTTPS (Apache) Redirect all non-secure (HTTP) requests to use a secure (HTTPS) connection.
Popular in IIS
- Redirect All HTTP Requests To HTTPS (IIS) Redirect all non-HTTPS requests to use an HTTPS connection.
- Enforce Lower Case URLs (IIS) Force URLs to lowercase, especially important for SEO on Windows-based servers, which are case-insensitive.
- Add Caching for Static Assets (IIS) Increase performance and reduce bandwidth use by adding caching directives that browsers will use to cache static assets client side.
- Canonicalize Host – Add/Remove www (IIS) Canonicalize host name to enforce either a www-prefixed domain or non-www-prefixed domain.
- Enable GZip Compression (IIS) Reduce file sizes and increase response performance by enabling GZip compression of text-based responses.
- Manage Static Rewrite Rules with RewriteMaps (IIS) Centrally manage any number of redirect and rewrite rules by leveraging an external RewriteMap configuration file.
- Rewrite URL as Query String Parameters (IIS) Create SEO friendly URLs by tokenizing the URL into query_string parameters.
- SEO Friendly URLs in WordPress (IIS) Yes, you can run Wordpress in IIS and have SEO-friendly URLs.
- Enable/Disable Directory Browsing (IIS) Turn directory browsing on or off. Can prove useful during development.
- Redirect Default Document to Directory (IIS) Redirect all requests to a default document to its parent directory URL. Important SEO tactic to avoid duplicate content penalties.
Popular in NGINX
- Add Caching for Static Assets (NGINX) Send browsers caching directives that they will use to cache static assets on the client-side.
- Enable GZip Compression (NGINX) Enable compressed responses using GZip to reduce bandwidth and increase performance.
- Block Specific User-agents (NGINX) Disallow specific User-agents' requests. Useful for dealing with malicious bots.
- Remove File Extensions From URLs (NGINX) Clean up the appearance of URLs slightly by removing file extensions. Used to tidy up URLs a bit, not to 'cloak the technology in use'.
- Block Known Bad Requests (NGINX) Block bad requests to file extensions not supported on the server.
- Canonicalize Host – Add/Remove www (NGINX) Enforce canonical host names by either prepending www or explicitly omitting it from the domain name.
- Redirect Old Domain to New Domain (NGINX) Redirect all requests for an old domain to a new domain.
- Enforce Lower Case URLs (NGINX) Force URLs to lowercase, very important for SEO to avoid duplicate content penalties in search engines.
- Reverse Proxy To Another Server (NGINX) Proxy an intranet, or other, server's content through a different webserver.
- Redirect All HTTP Requests To HTTPS (NGINX) Redirect all non-secure requests to use an HTTPS connection.