RSSAmplifier

Damian Nicholson · Nov 1, 2010

Nginx rewrite rule

0
Sign in to vote or save

Damian Nicholson · Damian Nicholson

Typewriter with paper showing repeated text "rewrite... edit... rewrite... edit... rewrite" against a ruler backdrop

A snippet of my nginx config file showing how to rewrite all urls from www.yourdomain.com to yourdomain.com.

Very simple, but worth knowing if opting for nginx over Apache.

server {
  listen 80;
  server_name www.damiannicholson.com;
  rewrite ^(.*) http://damiannicholson.com$1 permanent;
}
server {
  listen 80;
  server_name damiannicholson.com;
  ...
}

Related posts

TypeScript code editor showing a build app configuration file with Fastify setup and environment variables

Building a blog with Fastify, SQLite, and zero frameworks

Why I built my blog with Fastify, SQLite, and server-rendered templates instead of Next.js and Postgres. The stack, the trade-offs, and why boring tech won.

Tailwind CSS logo with blue wave icon and black text

Tailwind, layoffs, and a familiar open source tension

Tailwind CSS is a huge open source success, but its business model has limits. A look at layoffs, AI, and why adoption does not equal leverage.

1Password on laptop

Using 1Password as Your SSH Agent on macOS

How to configure 1Password to manage SSH keys and prompt you to approve SSH connections on macOS.

Read the original on damiannicholson.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.