Website Redirect Alternative - Two URLs to use same code base - html

Currently I have a redirect setup in my domain host's dns for example2.com to goto example.com
I don't want it to redirect but rather stay as example2.com while displaying the exact content from example.com. I don't want to copy the site's code between the two. I want a single code base and both URL's to use the same code.
I am not sure how to achieve this using my web host's CPanel. I thought I might be able to do it using cnames or aliases but that does not seem to work. I am sure someone has had this experience before.
I believe this is a pseudo-programming question but if a mod decides this is the wrong stack please do move it.

303 headers need to be sent with a new domain or in this case example.com, for apache or php related steps see these links:
http://www.inmotionhosting.com/support/website/htaccess/redirect-without-changing-url
redirect to a page without changing the url
Redirecting to HTTP error documents without changing the request URL
For explanations:
http://en.wikipedia.org/wiki/URL_redirection
http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection

Related

it is posible to get anotehr address from using pre-name on url?

If for example I have site call
xyz.com
how can I force my server(Asp.net/iis)
to go to another page if i ask for
a.xyz.com
it is posible?
for example: m.xyz.com leads to xyz.com/mobile.aspx
thanks!
The solution involves multiple steps:
You need to configure the subdomain in your DNS.
You need to create a website in IIS to handle the subdomain. There's a guide here on how to do this. Pay attention to the "Host Header" part - That's where you set you m.xyz.com address.
You need to setup an HTTP redirect (301 / 302). You can do this from the config file with the httpRedirect element (More details here).

Displaying remote URL

First I must explain I am a total newbie with regards to web design.
My question is as follows:
I would like to have a remote URL displayed through a different web server. The remote URL resides on an internal firewalled server and I would like to give public access to a single page by displaying it on a remote web server that has access to the firewalled page. I have tried iframes but they use the clients IP which results in the page failing to display. I have limited access to the server (CPanel) - please advise how this is possible? The remote URL will be requiring a login - not sure if this will have relevance on the solution.
What you can do is create a page which makes a request to the firewalled page using either CURL or HttpWebRequest or any compatible technology based on the platform you have chosen. It can then trim out the headers and other tags which are not required and render the html in a div, or it can just redirect the entire code in the response of your page.
This way, there will be no connection made from the client end, just your server will connect to your firewalled server and fetch the page from there and in turn give it back.
The only problem here is, forms - images and linked objects might not work properly, you might also have to parse them and replace the respective urls to point to your server which in turn proxyfy it.
Here is an example of it
https://proxify.net/

difference between http and www

pardon me for asking a very basic doubt.
I have hosted a page in the site collinfo.annauniv.edu
The page opens fine when i enter the address as http://collinfo.annauniv.edu
But when i gave www.collinfo.annauniv.edu my browser shows 404 error.
What is the difference that http causes here in place of www.
The www. before your domain is actually a subdomain. It's essentially the same thing as help.microsoft.com or orders.amazon.com.
With that in mind, there are a few things that could be happening:
1) Your DNS records do not include the appropriate A Record for the www subdomain.
In this case, you'll need to setup an A record that points to your web site's IP address. If you don't know how to do this, your web host should be able to help.
2) Your server is not configured to handle the www subdomain.
If you're using the apache web server, it needs to be configured to show your web site when the user enters www before your domain. Again, your web host can set this up for you.
It all comes down to a misconfiguration issue. If you don't have experience administering web servers, you may want to give your web host a holler.
www comes from the (rather) old time where a domain had several sub-features, of which the web was not always the main service. For instance
www.domain.tld for web
mail.domain.tld for mail
ftp.domain.tld for ftp
domain.tld for web
but this is a convention - any subdomain may point to anything actually.
This is more a question of DNS declaration and/or web-server configuration ; in this case it is probably that the web-server configuration does not trigger the same pages for www.domain and domain (since you get a 404).
The author / administrator of collinfo.annauniv.edu either forgot to create a DNS entry for www.collinfo.annauniv.edu or did not create a virtual domain (web-server side) for it that would point to the same pages as collinfo.annauniv.edu.
HTTP is a protocol.
http://collinfo.annauniv.edu
Is the address of a resource which can be retrieved using HTTP.
annauniv.edu is the domain in your case.
collinfo is the subdomain.
www.collinfo is also considered as a subdomain but it does not exist. That's why you get HTTP 404 not found.
Subdomain can be anything, www is usually used as it usually mean World Wide Web.
WWW is a subdomain
HTTP is a protocol (language)
Whether you specify HTTP in the browser or not, the browser will always assume the request is being of "http" type and will ussually add http:// for you.
WWW however is just an alternative subdivision of the domain name, the same as in:
www.domain.com
site.domain.com
sub1.domain.com
sub2.domain.com
.....
etc.domain.com
In most cases the WWW subdomain will point to the same "page" as the main domain, which is usually called the "index" page, such as index.html, or index.php and in most cases the index page is hidden in the browser's address bar, unless you specifically type it in, such as http://www.yahoo.com/index.html, but you have to understand that if you have a full control of your webserver you can modify these, so WWW doesn't point to the same page or you can call you main page "home.html" instead of "index.html" and instruct your webserver to "point" your browswer to that page by default.
But things like HTTP are not easily changed, since HTTP is the main language of the web and most browswers use that as the primary means to access the webservers.
Peace!

Redirected Domain Problem

We have 2 different websites. One is xy.com another is xyz.com. The domain xyz.com is redirected to a folder on xy.com\one
This works fine. Now we want a particular link to be opened (for example, www.xyz.com\abc.html). I am placing this file in xy.com\one\abc.html. But when I enter this url, it takes me to home page, instead of abc.html. Though I can open abc.html, by entering www.xy.com\one\abc.html.
I need to open this file, from link, www.xyz.com\abc.html. How to accomplish this??
Regards,
Rahul Jain
I think the problem is your slashes are reversed. Did you keep your url's near a strong magnet?
If you are using apache you might want to have a look at mod_rewrite. There are similar methods available for other servers.
Would be good to know which environment you are using (web server and server side language) and if you are applying the re-direct rules in a programmatic way or via server configuration.
To give a serious reply, there could be several things wrong in the redirect.
You have to setup a redirect from the old domain to the new, by using a .htaccess on the old domain, changing the DNS records for the domain, or probably some other alternatives. Which of these have you used?
In case of the second option the receiving server (xy.com) has to accept the incoming domain (xyz.com). When I set my DNS records for a domain to go to a certain server, I have to actually setup the server to accept that domain, usually by "parking" it in Cpanel. Some hosts charge per parked domain, which is why they don't accept the incoming traffic automatically.
Depending on the method used, the receiving server has to be told what to do with the request.
So most importantly: HOW did you set up the redirect? Was it a DNS record? Was it a htaccess on the side of xy.com? Any other methods? (sorry, this isn't really an answer either but it was too long for the comments)

Subdomains do not work without the leading www

What is the difference between the following URLs?
http://www.forums.example.com and
http://forums.example.com ?
Actually I've created a new subdomain in my website and it's working fine when I try to access without www (i.e http://forums.example.com) But when I try to give URL like http://www.forums.example.com it is showing "Page not found".
Why is this and how can I fix the issue?
If I am not mistaken, www. is also considerd a Subdomain, hence when you setup hosting on a provider (i.e Slicehost) they tell you to put www in the subdomain list (again if I am not mistaken). If you really want www.fourms.duckyetc you can set up a script to do some matching, i.e
if url contains www.fourms.ducketc then go to here else go somewhereelse
You have to create a cname for www.forums.duckyvideos.com and also configure your webserver to respond to that cname. There is nothing automatic about www prefixes on the web. It's just a convention that websites are accessible with or without the www. Everyone hosting a website has to explicitly set up a second cname for the www prefixed version of every site they put up.