skip to Main Content

I have a question that I couldn’t find the answer because I don’t know how to search it in English 🙂

How can I let my customers have their own domains redirect to my server and identify them? Like WordPress.

For example, I have created a simple CMS system and customers can register and have their own pages like john.mysite.com. But if they want to use their domains, do I have to create all of those domains on Plesk? By the way, I’m using IIS 7.5 with Plesk.

I also don’t want to use iframe.

Example;

john.mywebsite.com/categories-150.html –>
www.johnswebsite.com/categories-150.html

But it should be using the same code. I shouldn’t have to copy all the source codes and create seperate domains for this purpose.

For sure, I can make them change their ns to my server and specify an A record but how can I identify it by code? (C# ASP.NET MVC) I assume I can search for the domain name over database and get the ID but how can I pass the domain name?

I hope you can understand 🙂

Thanks and regards

2

Answers


  1. Your Question is not to clear to me, but ima try to help you

    first you need to change DNS settings and point to your IP

    then in iis you make a site and add that domain as the hostheader

    and to get the requested url ou can use

    Request.Url or look in the Request.ServerVariables["SERVER_NAME"]
    

    for more info on server variables
    http://msdn.microsoft.com/en-us/library/ms524602(v=vs.90).aspx

    Login or Signup to reply.
  2. As I see it, it is some string manipulation and using a dictionary to get what you want.

    E.g.:

    // preparation of the dictionary to map your sub domain to the clients website
    IDictionary<String, String> clientRedirect = new Dictionary<String, String>();
    clientRedirect.Add("john", "www.johnswebsite.com");
    
    ...
    
    // actual processing incoming request
    String strToRedirect = @"john.mywebsite.com/categories-150.html";
    String relPath = strToRedirect.Substring(strToRedirect.IndexOf(@"/")); // = "/categories-150.html"
    String subdomain = strToRedirect.Substring(0, strToRedirect.IndexOf(@"/"));
    subdomain = subdomain.Replace(@".mywebsite.com", ""); // = "john"
    
    String newUrl = clientRedirect[subdomain] + relPath; // = "www.johnswebsite.com/categories-150.html"
    
    WebRequest request = WebRequest.Create(newURL); // use the URL
    

    Or do you mean something different?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search