I need help with redirects

advertisements

There is a page with two domains:
www.exampleone.com
www.exampletwo.com

I need a redirect to the start page:
www.exampleone.com to www.exampleone.com/#!/news.html
www.exampletwo.com to www.exampletwo.com/#!/news.html

and last but not least, for every page I need a redirect like this, e.g.: www.exampleone.com/about.html to www.exampleone.com/#!/about.html www.exampletwo.com/about.html to www.exampletwo.com/#!/about.html

I don't really know how to solve that, should I use Javascript or .htaccess? for the last redirect in my example, it's better to use conditions right? but how?

any ideas?

Note: The contents are loaded with ajax, so the index page is always the same, that why the /#!/... thing.

EDIT: straightforward, there are the live addresses http://www.jester04.ch or http://www.jester04baden.ch, the startpage redirect is solved as you can see in the js file, but for the /#!/ redirects I still need help, thank you.


You can put this block of JS code inside separate .js file then include this file in every page:

var sURL = (window.location.href + "").replace("http://", "");
if (sURL.indexOf("/#!/") < 0) {
   if (sURL.substr(sURL.length - 1, 1) == "/")
       sURL = sURL.substr(0, sURL.length - 1);
   var arrTemp = sURL.split("/");
   var sDomain = arrTemp[0];
   var sPage = (arrTemp.length > 1) ? arrTemp[arrTemp.length - 1] : "news.html";
   var sNewUrl = sDomain + "/#!/";
   for (var i = 1; i < arrTemp.length - 1; i++)
      sNewUrl += arrTemp[i] + "/";
   sNewUrl += sPage;
   window.location.href = "http://" + sNewUrl;
}