Redirect with cname to subdomain while retaining cname web address - redirect

i have this problem where i have a subdomain sub.host.com and a new domain www.new.com. I want to redirect www.new.com to sub.host.com without showing the browser that the url had changed. The content is in sub.host.com but i want that even after the page has fully loaded, it is still showing www.new.com
This means also that when i go to sub.host.com/function, it should also appear as www.new.com/function
The reason is the actual subdomain looks ugly and contains numerics. Is this possible to do? Ive tried searching but all that comes up are only about how to go about creating cname records and none about keeping it intact after redirecting. Thanks

A (reverse proxy) server like Nginx, which is very light-weight, features the url-rewrite rules that you need. IIS7 has also a good url-rewrite engine.

Related

Domain Forwarding for specific URLs

I have a domain with GoDaddy called "livingmiracles.org". For years I had this domain forwarding to my livingmiraclescenter.org Joomla website. Recently, I discovered that the way the livingmiracles.org domain now forwards to our livingmiraclescenter.org site has changed and has left me with broken links on almost all of the over 60 websites I manage.
This is what used to happen:
Any URL of the livingmiraclescenter.org website would be able to be displayed with the livingmiracles.org domain instead. For example, the following URLs were interchangeable:
livingmiraclescenter.org/david-hoffmeister.html and
livingmiracles.org/david-hoffmeister.html
livingmiraclescenter.org/contact.html and
livingmiracles.org/contact.html
livingmiraclescenter.org/spiri-tv.html and
livingmiracles.org/spiri-tv.html
Also, variations of the above without ".html" would work.
Now, none of this works anymore. For the "livingmiracles.org/" links above, now, either the livingmiraclescenter.org home page pulls up or I get a GoDaddy error page.
I called GoDaddy and they confirmed a change in the way they handle domain forwarding now.
Can anyone suggest a simple/smart way—perhaps a RewriteRule or something like that—that I can set up somewhere (where?) to handle those specific page redirects? Basically, I want all my livingmiraclescenter.org links to be interchangeable with livingmiracles.org links like I wrote above in those examples.
Thank you so much!
Jutta

cnames & URL redirects

I was really hoping someone may be able to help me.
My goal is to have all 3 of the URL samples below redirect to the same place, specifically to http://deals.domain.com/index.html?parameter=variable
Notes:
(1) 'deals' is a CNAME within domain.com for another.domain.com
(2) 'deals' is a subdomain within domain.com which has a URL redirection set up to point to the goal URL above.
So far...
www.domain.com --- this is redirecting fine
domain.com --- this is redirecting fine
deals.domain.com --- this one does not appear to be redirecting. When you type it in, it remains in the address bar and does not seem to take into account the variables after the ? in the goal URL (even though ultimately they are not shown in the address bar, but they do lead to a difference in Web content being shown). It is however showing the basic content of another.domain.com
Maybe it is not wise to have the same thing 'deal' be both a CNAME as well as s subdomain; however, the CNAME is absolutely necessary so not sure how to get around this?
Within my ISP, I have set up the Zone records in the Domain section; but not sure I really understand because I can definitely see the CNAME record sitting there, yet it still let me set up a subdomain in the hosting section in a folder which I specified, I thought it wouldn't allow that.
Grateful for any and all advice.
Kind regards,
Mike

MVC Page routing replaces part of subdomain when subdomain text is also part of the route

I've got a strange problem with routing MVC paths to aspx pages. It all works find except for some rare scenario's. Actually not that rare as it's happened twice this month.
So We've got old aspx pages but we need to have friendlier URL's. That's the background, can't avoid it for reasons I won't go into.
So I have a page ~/MySubFolder/Plans.aspx
We need the URL to be ~/Things/Plans
so I have a page route in route config
routes.MapPageRoute("Tickets", "Things/Plans", "~/MySubFolder/Plans.aspx");
This all works fine in most circumstances.
The app is SaaS product and we determine the tenant in context based on the url they use. So each tenant gets a subdomain on our app like http://clienta.ourapp.com
So this is the problem.
We had a client sign up and they picked their subdomain to be http://plans.ourapp.com
The client does not have any problems except when they try to access our path ~/Things/Plans. when they do that we get an error. It's one of our own exceptions and it happens because on every request we determine who the tenant is by looking at the subdomain.
for some reason when we examine the domain name routing has stripped out the plans part of the sub domain name and is http:// .ourapp.com instead of http://plans.ourapp.com.
So this is obviously caused by the fact that the word plans is the subdomain and plans is also the end of the route Things/Plans
We need to somehow avoid this happening, maybe the route is not setup properly or maybe it's just a bug but would be great to figure out exactly why this is happening so we can fix it.
Thanks
So turns out this had nothing to do with routing the URLs. Somewhere else in code where we try to evaluate the current tenants URL we were for some reason replacing part of the URL based on another part of the URL which was the problem in some scenarios. No wonder no-one had an answer for this

Web Forwarding or CNAME Solution - Which is Correct?

I have recently done some website work for a charity. The site I have built has been hosted on my own domain, in a directory. The site's address is www.mydomain.com/newsite/
The organisation has purchased their own URL and would like that URL to point to my hosted site such that the user goes to www.Charity.org and is shown the content from www.mydomain.com/newsite/
I've partially achieved what I wanted to do by using a 302 redirect and a frame, which I set up through the control panel for www.Charity.org, however this has the disadvantage of never displaying anything other than www.Charity.org in the address bar.
Essentially I would like to "mask" the mydomain URL with the charity one, so that the folder structure is still visible to the end user. If they go to www.charity.org/events then that's what they should see in their browser, but the content should map to www.mydomain.com/newsite/events
I have explored CNAME and A NAME solutions but neither of these seem to allow me to point to a directory.
Is this even possible?
The solution is A NAME record.
In DNS zone file of charity.org, create A NAME record of www (& #) to point to your server IP (where the website live).
On server, you'll have to set DocumentRoot for www.Charity.org host. DocumentRoot must be the directory in which default webpage (index.htm, index.php etc) live. Done!
Provide your web server details if you need further help about setting DocumentRoot.
This can also be done with CNAME, but it'll require more complex server side configurations. And, I don't recommend to use masked web forwarding because its not SEO friendly and universally compatible.

Will re-direction from home page affect search engine crawling?

There is a new domain, let's say va.in.
Content is being prepared for the sub-domain a.va.in
The idea is that va.in/index could contain pointers to various sections sometime in future (e.g. b.va.in, c.va.in etc.). As of now, it does not make sense to have such a page as there is just one section i.e. a.va.in
If I decide to re-direct va.in to a.va.in for now, will the search engines follow the re-direct and index the site?
Is DNS the best place to do the re-direction?
Using "301 Moved Permanently" search engine will only index sub-domain a.va.in.
If that's ok, you can do this using web server's config.
For example in Apache:
<VirtualHost va.in www.va.in>
Redirect permanent / http://a.va.in/
</VirtualHost>
You can't really use DNS to do redirect, because in DNS you cannot assign CNAME to #.
See: Is Root domain CNAME to other domain allowed by DNS RFC?
There is question related to yours: 301 Redirect vs DNS change: Is it ever safe to kill a 301 redirect and update the DNS for a subdomain?
Yes, the search engines follow redirects, if you redirect with a HTTP header
header ('HTTP/1.1 301 Moved Permanently');
header ('Location: '.$location);
I don't know about DNS redirect, but I'd rather not use it..
You can read more about how to do a HTTP redirect here.
You can redirect in two ways.
Programaticlally as evilpenguin said
Using the webserver (Example iis)
But there is one thing common in both these options. The redirect must be permanent redirect if you want to inform search engines that va.in is permanently moved to a.va.in
If you dont specity permanent redirects, still crawlers will go to a.va.in but in this case they wont be notified that it is a permanet redirect.
If some one has bookmarked va.in and in the first case (permanent redirection) bookmarks will get updated. But in the second case book marks wont be updated.
Hope this helps.