Monday, April 23, 2012

Redirect on new domain with alert

I have a a domain: www.olddomain.com
I am moving to www.newdomain.com

and I am using currently using nginx with this parameters:

    server_name www.olddomain.com;  
    access_log /var/log/nginx.access.log;
    error_log  /var/log/nginx.error.log debug;
    root /var/www/webroot/;

    location / {
        index index.php index.html index.htm;
        if (-f $request_filename) {
            break;
        }
        rewrite ^(.+)$ /index.php?url=$1 last;
    }
    location ~ .*\.php[345]?$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /var/www/webroot$fastcgi_script_name;
        include        /etc/nginx/fastcgi_params;
    }
 
Now I want to redirect the people that are contacting the old domain the the exact same place on the new domain BUT I want to communicate the people that we have a new domain name.

I thought that the way to do it is to have an address that have a message that is a little better but not that different than  "We changed name, you will be redirected in 5 sec" and then redirect them to the new domain (that nginx should pass as a query parameter called newurl). The redirect splash page is at /OldSite/home (but using the old rewrite schema - I am using CakePHP)

This is my attempt but it does not work:

    server_name www.olddomain.com;
    access_log /var/log/nginx.access.log;
    error_log  /var/log/nginx.error.log debug;
    root /var/www/html/app/webroot/;

    location / {
        index index.php index.html index.htm;
        if (-f $request_filename) {
            break;
        }
        rewrite ^(.+)$ /index.php?url=/OldSite/home?urlnew=www.newdomain.com/$request_uri last;
   }

It looks like the rewrite work but it seems that cakePHP does some magic and I see the same as I did not change anything: the site completely ignore  "/OldSite/home?urlnew=www.newdomain.com/". I am not sure what CakePHP is doing at the routing level.

Anyway, how can I make it work?

Best,
   Chris

--Everything should be made as simple as possible, but not simpler (Albert Einstein)

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate