Welcome! Log In Create A New Profile

Advanced

Redirecting all websites under WPMU using domain mapping plugin to add www in front of url

Posted by BaldwinKoo 
I have a WPMU setup using Doncha's domain mapping plugin and am trying to get all sites setup under WPMU with the domain mapping plugin to go from non-www to www. When I enter the url without the www the site isnt found and takes me to the site registration page. So I am trying to get example2.com to redirect to www.example2.com everytime.

My question: is there anyway I can do this without adding a another server directive and have any site without the www to add www? I tried using * in place of the domain and did not work. Any push in the right direction would be appreciated. Thanks

Here is my current setup:

[code]
server
{
listen 80;
server_name example1.com;
rewrite ^/(.*) http://www.example1.com/$1 permanent;
}
server
{
server_name_in_redirect off;
listen 80;
server_name *.example1.com;
access_log /home/baldwin/public_html/example1.com/log/access.log;
error_log /home/baldwin/public_html/example1.com/log/error.log;
# rewrite rule - files
location ~* ^.+.(xml|html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf)
{
root /home/baldwin/public_html/example1.com/public;
rewrite ^/.*(/wp-.*/.*\.(xml|html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;
rewrite ^.*/files/(.*(xml|html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ /wp-includes/ms-files.php?file=$1 last;
expires max;
break;
}
# rewrite rule - sitemap
rewrite ^(.*/)?sitemap.xml wp-content/sitemap.php;
# All other requests go to WordPress
location /
{
root /home/baldwin/public_html/example1.com/public;
index index.html index.htm index.php;
rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last;
if (!-e $request_filename)
{
rewrite ^.+/?(/wp-.*) $1 last;
rewrite ^.+/?(/.*\.php)$ $1 last;
rewrite ^(.+)$ /index.php?q=$1 last;
}
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ .php$
{
include /usr/local/nginx/conf/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/baldwin/public_html/example1.com/public/$fastcgi_script_name;
}
}
[/code]
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 168
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