Monthly Archives June 2007

Nginx redirect www.example.com requests to example.com or vice versa

Add following configuration directive if you want to redirect www.example.com to example.com server { server_name www.example.com; rewrite ^(.*) http://example.com$1 permanent; } server { server_name example.com; Put here your domain hosting configuration. } Add following configuration directive if you want to redirect example.com to www.example.com server { server_name example.com; rewrite ^(.*) http://www.example.com$1 permanent; } server { [...]

Nginx and WordPress setup clean SEO friendly URLs

Open your nginx configuration file: # nano /etc/nginx/nginx.conf Locate your domain (example.com) virtual hosting configuration and before “location ~ \.php$ {” add following lines: if (!-e $request_filename) { rewrite ^(.*)$ /index.php?q=$1 last; break; } At the end your configuration should look as follows: server { server_name example.com; index index.php; root /var/www/example.com; if (!-e $request_filename) { [...]