Keep old URL after redirect - apache

How do I keep the URL after redirecting to a new server?
I have a server on Amazon, with a IP address for its URL. I also have a domain name which I got from nic.ru (a Russian hosting company). I paid $5 and got nic.ru to do a redirect to my new server.
When the redirect goes through, the URL that is displayed is the Amazon server IP (that is, I type http://bezpontavto.ru which is redirected to http://54.186.37.214/; but 54.186.37.214 is then displayed in the URL bar) I want the URL to redirect from http://bezpontavto.ru to http://54.186.37.214/ yet still display as http://bezpontavto.ru in the URL bar.
I dont have access to the apache.conf file at nic.ru (they do it automatically). I have however set up mod_rewrite, on my new server, and have a nice new blank .htaccess file set up in the /var/www/html/ directory.
What do I need to do to display the old URL in the url bar?
(I guess this is pretty simple, but I have been hitting my head against the wall all day, any help would be much appreciated)

You want to get nic.ru to set up A records that point to your new server. This is usually possible without additional charges, and there is usually a DNS configuration interface to make it possible.
Your Amazon server needs to have been prepared to serve the .ru domain (Apache needs to have a VirtualHost entry set up).

For anyone looking fo do a frame redirect from nic.ru, you have to do it under the menu item "My Domains" (Мои Домены):
To do a DNS redirect, which Pekka mentioned was superior, nic.ru offers a DNS service. The details are at http://dns-master.ru/tariff/en/

Related

Get FQDN from domain

this is my first question here, so I will try my best.
I am trying to get the protocol and the FQDN (fully qualified domain name) from a bunch of domains, i.e. get https://es.aliexpress.com from aliexpress.com.
I have tried Selenium webdriver, but it takes too long to compute all the domains (even with short timeouts and blocking images).
I am asking if someone knows a way to do this without loading the content, something like wget but only for the URL.
Thank you for reading.
Not really...
First of all, http and https have nothing to do with domain names. Those are transfer protocols.
Ignoring that part, what you are calling FQDN are often generated at the time you access them.
For instance, many websites redirect the browser from a desktop site to a mobile version (the typical m.something.com) based on your User Agent string. Which mean www.something.com and m.something.com are both valid answers
In the example you gave, aliexpress.com, prepended es. which means there is most likely some code on the server that reads in either your location (based on IP address) or a locale setting in your browser to direct you to the es version of the website as opposed to the en or dk version.
These changes can be done via an .htaccess file in the root folder of the website, or via back end code.
Google Chrome itself automatically tries to add www. if it looks like you typed a URL into the everything bar.
It's also possible that the URL is one giant redirect. Some websites buy up extra domain names that all redirect to their core site. So even if you input xyz.com you'll end up at abcd.com.
There is no algorithmic way to go from a base URL to what you're calling the FQDN.
P.S. Here is an article about what FQDN means.

htaccess http request re-routing

Reason for Problem:
I'm working on a website and wanted to work on it without making edits to the live website. My hosting package allows for "infinite" domains. So instead of editing the live website I create a new domain, without purchasing the domain name and am trying to develop with this new domain.
Issue At Hand:
This issue is that the reference file paths don't work anymore and return 404 when trying to load the webpage. My original website directory structure looks like this
cgi-bin
config
public_html
->JSfiles
->CSSfiles
->PHPfiles
The new one is the same structure however when you open the "temporary web address" the URL looks like this
http://217.199.187.199/myTempAddress.com/"
instead of
http://myTempAddress.com/
so when my index.html file looks for /JSfiles/someJSfile.js its requesting
http://217.199.187.199/JSfiles/someJSfile.js
when it needs to be requesting
http://217.199.187.199/myTempAddress.com/JSfiles/someJSfile.js
Things I've Tried Unsuccessfully:
I would really like to fix this by redirecting with the .htaccess file in the root directory on the server. Ive tried using the following directives with no success.
Redirect /217.199.187.199/JSfiles/mustache.min.js http://217.199.187.199/myTempAddress.com/JSfiles/mustache.min.js
Redirect /JSfiles http://217.199.187.199/myTempAddress.com/JSfiles/
Redirect /JSfiles http://217.199.187.199/myTempAddress.com/
Redirect /JSfiles 217.199.187.199/myTempAddress.com/
Question:
How can I redirect the requests to the right location? I need all the the requests to be of the form http://217.199.187.199/myTempAddress.com/someDir/Somefile.ex
You need to read up a bit more on Virtual Hosting in particular name based virtual hosting.
https://httpd.apache.org/docs/current/vhosts/name-based.html
It sounds like your provider might support name based VHosts but what you're trying to do is not taking advantage of that. To do what you want ie have path that points to a different version of your site is best achieved using mod_rewrite. See this
https://httpd.apache.org/docs/2.4/rewrite/remapping.html
You need to make sure that your provided actually supports this.

Using apache for dns blocking page and removing all jargon in URL

I have a little DNS Spoofing / Blocking system I setup for work. It simply uses a blacklist to spoof the dns records and simply points them to a BLOCK / DENY page.
If I go to the URL directly for instance http://www.redtube.com the system works as expected and displays my index.html and what it should
The problem arises if I go to http://www.redtube.com/video?/43 or anything other than the full domain I get a not found.
I need to to configure Apache so that it drops all the junk after the TLD and simply displays my page such as http://blocked.project.com
Another way to look at it would be to say redirect to index.html if the url entered is not known to the webserver.
Any help greatly appreciated.
Used an apache FallbackResource to achieve exactly what I was after. Had to make sure my image paths on the website were absolute but works a treat.
http://httpd.apache.org/docs/2.2/mod/mod_dir.html#fallbackresource

Trouble setting up a subdomain on a VPS under Ubuntu and Apache

I'm a complete newbie when it comes to servers, so I need some help. Basically, I want to have a subdomain on my VPS. I'm not too concerned where the files reside, though of course I would like them separated if possible.
I found a guide to doing this that basically sums the procedure up in five steps:
Create directories to host the content of a new virtual site.
Make a copy of the /etc/apache2/sites-available/defaults file with a site appropriate name.
Change the two /var/www/ entries to the actual directory of the new site.
Add the ServerName line with the real domain name you will be hosting.
Use a2ensite to enable the new site, and finally reload Apache2 so it knows about the new site
I tried all of this, but I can't get it to work. I didn't get any errors at any point during this process, but when I enter the address with the subdomain into my browser, I get a "Server not found" error.
The company that hosts my VPS has an admin page where I can set up subdomains. Stupid question: do I have to do reconfigure the DNS records or something while doing this, or is it likely that the problem is caused by something else?
Additional note: I followed a guide on howtoforge.com when setting up the server, which in hindsight may not have been the brightest move on my part. It is possible that I made a mistake there that is somehow affecting me now?
Assuming you've setup the subdomain correctly in your VPS' admin page, the only thing left to check here is that you've actually created the subdomain in your DNS administration page (have you?). For example, I use afraid.org to manage my DNS records and to add a subdomain, it's essentially:
Type: A
Subdomain: sparky
Domain: example.com
Destination: 120.34.2.3 (this would be your VPS' IP address)
In general, you add a (sub)domain by:
sparky.example.com A 120.34.2.3
Please keep in mind that you want to add an A record (this is important!).

How to create subdomain in IIS6

I'm quite new to the configuration of domains and subdomains.
I already have a subdomain "bar" that belongs to the domain "www.foo.es". When I want to access to the subdomain I just have to type "www.foo.es/bar", everything is alright so far.
What I intend to do is that the subdominion is accessed typing "bar.foo.es".
I've tried some things I found online but none of them worked. Could you tell me how to do this or at least give me some clues or tutorials that actually work?
I'm trying to set all up using the IIS6 properties (not dynamically, as it is not a user thing, just a subdomain that I want to access "directly".
Assuming you are working with a live server that you REMOTE DESKTOP INTO and not a shared hosting account here is what you will need to do:
Let's assume your file system looks like this:
c:\inetpub\wwwroot\www.foo.es { some html files in here}
c:\inetpub\wwwroot\www.foo.es\bar {some html files in here}
Without any custom ISAPI filters installed, you would do this by setting up two WEBSITE's in IIS.
The first website would have a home directory of c:\inetpub\wwwroot\www.foo.es and the 2 host headers "www.foo.es" and "foo.es"
The second website would have a home directory of c:\inetpub\wwwroot\www.foo.es\bar and 1 host header "bar.foo.es"
Once you DNS has a CNAME of "bar" that points to your server and you clear your local dns caches, this should work. If you don't know how to make the DNS change the easiest thing you can do is log into to your domain name control panel from whoever you purchased the domain name with and do the following:
ADD A CNAME RECORD:
For the host enter "bar" for the points to enter "foo.es" and you should be all set.
First of all you need to add an entry in your DNS in which you specify the "bar.foo.es" subdomain and the IP of the server to which it points to.
After that, in IIS you will have to create a site for the new subdomain you have just created. For that: right click on Web Sites -> New Website -> follow the steps normally but when you encounter the text box for the "Host header for this Web site (Default: None)" fill it with your subdomain value ("bar.foo.es").
Alternatively, if your web site is already created, you can bind subdomains to it by right clicking on the site -> properties -> Web site tab -> Advanced (the button near IP address) -> add / remove / edit the domains for your site which are represented by the "Host header value".
Please note that what you have at the moment ("www.foo.es/bar") is not a subdomain but a relative address.