Welcome! Log In Create A New Profile

Advanced

redirect multiple sites with www to the same domains without www

Posted by dimitre 
redirect multiple sites with www to the same domains without www
June 19, 2013 04:30PM
I want to make a server block, or location block (not sure which works) using regex to redirect all domains with www to the same without www.

something in this lines:

server_name ~^(www\.)?(?<domain>.+)$;
rewrite ^ http://$domain$request_uri? permanent;

Any help would be great
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 286
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready