I got problem trying to set the URL of my site. The project is based on mvc azure.
Usually azure has URL like: xyz.cloudapp.net So when i set my site live i added a domain that points to the azure project. www.xyz.com.
The issue is that if i try to click on 'Contact' or 'About' buttons i want the URL on the browser to show up as www.xyz.com/about and www.xyz.com/Contact. But whenever i click on the about or contact button, the browser URL still shows as www.xyz.com.
I have over 50 pages in my site however, Google is only indexing it as one. Can some one please tell me how can i get this URL showing the pages i am routing too.
Use domain control panel, can routing with cname or A record. Use Url routing "/Contact" make sure "/"
For A record, use Azure Production VIP and enter the two recording. one hostname null(xyz.com), two hostname www(www.xyz.com). May also be a name you want to(my.xyz.com).
For cname, The only difference, dont use VIP. Instead use xyz.cloudapp.net
Use domain control panel for all these processes.
Sample Azure Url
Sample Cname Url
DNS Check see end of document WWW A Record
Related
We're trying to create pages in our Rails app that will eventually live on a subdomain of another partnering site. This would be like StatusPage, which allows users to create a status page with their account on the StatusPage site and then attach it to their own subdomain (e.g. status.usersite.com).
For example, if we wanted one of our pages (www.oursite.com/users/bobsplumbing) to be a subdomain on another site (ourservice.bobsplumbing.com), how would we go about it?
If it's useful info, we use Heroku to host the Rails app and we also utilize Route 53 and Cloudflare.
From your example I understand that you want to have multiple web apps since that would be your customer domain and your page will redirect to that page.
You will be better off to do NGINX (or whatever you use) redirects since they are faster and will take less time, being cached by the browser after the initial load.
To answer your question you can add this code to your routes:
sites = %w(bobsplumbing catsandboots)
sites.each do |name|
match "users/#{name}" => redirect("https://ourservice.#{name}.com")
end
You can also have a look at apartment gem.
I have a scenario where I have a web site that will be used by multiple customers.
But I do not want to publish the web site to each customer domain's. Instead I will publish the web site to an azure web site for example mywebsite.azurewebsites.net and I want all the customers domains to redirect to this mywebsite.azurewebsites.net but I need to know which customer is this so I can display the correct content. for example I am thinking about appending or sending a hidden custom parameter in the query string or such.
What I need to know is
How can I redirect all the domains to mywebsite.azurewebsites.net
How can I pass a hidden parameters in the redirect for example any request from the customer domain e.g "www.cust1.com/Home/Index" will be redirected to "mywebsite.azurewebsites.net/Home/Index?username=testuser" and "www.cust1.com/Home/Index?querystring=ffff" to "mywebsite.azurewebsites.net?querystring=ffff&username=testuser"
I do not want to publish any web site content on the customer web site that means the customer domain root directory will be empty.
There are quite a few different ways you can do this.
The first thing you need to determine is: How are you going to handle the redirection to mywebsite.azurewebsites.net?
Are you going to place code directly on the customers website to
redirect?
Do you have the access to the customers DNS's allowing you to forward their site to mywebsite.azurewebsites.net?
Do you want to create a CNAME record and point it to your Azure Website?
Method #1
If you have access to the customers website then this becomes the easiest method.
As you described above, I would simply redirect the user back to your site with some type of custom url i.e mywebsite.azurewebsites.net/customer1 .
When the user hits this page you could then set a cookie in their browser so that you know where they came from and then redirect them to the home page at mywebsite.azurewebsites.net. This would happen almost instantly and the customer would never notice.
Method #2
If you are able to forward the domain or they can only redirect the user to the main website at mywebsite.azurewebsites.net, you can simple look for the referring url when the request comes in. Then as you do above, based on the referring URL you can then set your cookie and show the proper content.
Method #3
This is assuming you have access to the customers DNS records and are able to create a CNAME record for www.customerwebsite.com -> mywebsite.azurewesbites.net
In that case, when the user visits the site you would just pull down the HOST and then set your content based on that.
The specific code is here:
string url = HttpContext.Current.Request.Url.AbsoluteUri;
// http://localhost:1302/TESTERS/Default6.aspx
string path = HttpContext.Current.Request.Url.AbsolutePath;
// /TESTERS/Default6.aspx
string host = HttpContext.Current.Request.Url.Host;
// localhost
You can find more information here: How to get the URL of the current page in C#
Let me know if you have any questions or end up implementing any of these solutions.
I have an old domain for a company that has merged with another company and they want to decommission the old site and redirect traffic to the new domain. OldCompany.com will now point to NewCompany.com. However, to keep their SEO rankings we also want to map the pages from the OldCompany.com domain to the corresponding pages on NewCompany.com.
I know it's possible to setup Rewrite Maps in IIS (I've done this), but if the OldCompany domain is now pointing to the NewCompany web server, but the site itself was not migrated, will I still be able to use rewrite rules in conjunction with redirects to point OldCompany.com/about.html to NewCompany.com/subDirectory/about.aspx?? Do I need to setup these pages in order to accomplish this? Will Rewrite rules work without the pages from the originating site in place?
Right now I am able to setup a HTTP Redirect for the entire OldCompany.com domain by just creating a new site in IIS and using the HTTP Redirect to do this. What I really want is the more granular solution outlined above, so that people get to the pages they are looking for and not just the new site's homepage.
You should not do the redirect with new site (in application level). This would just break any existing incoming links. Better approach is to redirect old domain (with the whole url path & query string that you may have) with 301 redirect and map all relevant old urls to urls in the new site.
Usually it's done with multiple steps:
Tell Google Webmaster Tools the new domain address (in case you use that)
Create IIS rewrite rule to redirect (with 301) old domain to the new domain, preserving path & query string info
Create IIS rewrite rules (in your new site) to map any old url to the new structure, with permanent redirect (301) or redirect to same other page when user can move forward, if exact page is not found from the new structure.
This will tell Google that the URLs have changed and point to the new location.
Suppose I own the domain mydomain.com and I have a web application on a server, at the URL http://99.99.99.99:1234/MyApplication/startpage.something
What I'd like to have is that if the user writes appserver.mydomain.com/ it goes to the application URL above, but the user still sees appserver.mydomain.com in the location bar (I used appserver instead of www to make the question more generic). I want also that if the user writes appserver.mydomain.com/app?q=120 it is like he typed http://99.99.99.99:1234/MyApplication/page?q=120, but the user still sees the URL as he typed it.
Until now (I'm using a cheap domain seller), I've been only able to have
http://appserver.mydomain.com:1234/MyApplication/startpage.something
or just http://appserver.mydomain.com but it remains only that in the url, even if there is a path or arguments in the URL.
I am mainly interested in Tomcat server, anyway any more generic istructions are welcome.
You can not do this. When a URL says http://something/, all browsers connect to port 80. To connect to port 1234, you must have it in the URL: http://something:1234/.
What you can do is:
create a URL redirect so that when a user connects to http://something/ (port 80), the request is redirected to http://something:1234/. You could do this using .htaccess redirect rules in the document root of your http://something/ site.
in the document root of the http://something:1234/ site, you could create a redirect rule that maps / to /MyApplication/startpage.something
With this solution, the user will see http://something:1234/ in the address bar. In case you need it, there are various resources on the web (and here on SO) on .htaccess redirects.
I'm working on an ASP.NET MVC Multi Tenancy app.
Right now I managed to create dynamic subfolders, for instance some one registers with username "bob" and gets the following website:
domain.com/bob
My next goal is to provide subdomains: bob.domain.com instead of subfolders.
I found out that it's very complex to create dynamic subdomains with ASP.NET and DNS WMI. Is there a way to tell the server that it has to redirect/rewrite from bob.domain.com to domain.com/bob ?
In regards to routing based on subdomain, you should reference the following SO post.
**Sorry, I normally don't like to just link to an answer, but in this case, I don't want to take the credit from the original poster for the solution*
EDIT
Check out solution 2 to follow up on my comments below as a working example. You can ignore the ISAPI rewrite as the MVC routing engine would do this for you given the above solution from SO. Below is a snippet that you might find useful:
Setup DNS Server
Add the following entry into your DNS
server and change the domain and IP
address accordingly.
*.example.com IN A 1.2.3.4 Setup the Web Server
We are assuming that you already have
a web site created for your main site:
www.example.com. So let's just double
check to make sure it will be able to
accept all variations of the
subdomains.
* Open IIS Management Console and select your web site.
* Right click on it and select Properties.
* Click on Web Site tab.
* Click on Advanced button.
* Make sure there is one entry under the Multiple identities for this
Web Site with Host Header Name field
blank. This entry will intercept all
requests that comes to this IP
address.
* Make sure the IP address is only used by this web site.