301 Redirect with Reverse Proxy - apache

I am currently struggling to resolve an issue stemming from a reverse proxy. We are running a reverse proxy from page.example.com to example.com/page/ . This original subdomain content is generated from Unbounce.com , and attached to the subdomain.
Problem: We want the subdomain ported to a sub-directory for SEO reasons. The reverse proxy works great, and properly ports the sub-domain, to the sub-directory. Our current issue is that the page.example.com is still getting indexed in Google. We'd like to install 301 redirects to allow only the sub-directory to get indexed. Because we do not have direct access to the content on page.example.com , I cannot put an htaccess file in place to redirect that traffic. Unbounce also charges based on "traffic", and the reverse proxy breaks their tracking information.
They have told us, if we put the 301's in place, their tracking info should push to the new URL structure, and work again.
If anyone could point me in the right direction, that would be fantastic.
Joe

Related

Keep old URL after redirect

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/

Redirect but keep the ENTIRE URL

I've got a problem with my domain structure (the title describes it very well).
What I've tested so far:
I googled a lot and found many threads about "Redirect from domainA to domainB without changing the URL" (often with .htaccess). They talk about simple redirect rules and the proxy flag and so on. So I tried a lot of them but everytime they just keep the path after domainB and redirect then to domainA.
What I want (detailed): I've got two domains with different IPs and when someone hit "http://www.domainA.com" it should just SHOW the content from "http://www.domainB.com" but also SHOW the URL from domainA. So when one is browsing trough my website like "http://www.domainA.com/link1" it also should show the content from "http://www.domainB.com/link1", but show the URL with "domainA".
Of course I could show you some htaccess code I used, but I start to think that htaccess is not the solution.
So I ask you guys: Is this possible with htaccess? What other solutions are possible?
You can use Mod_proxy module.
Put below in your virtualhost for www.domainA.com
ProxyPass / http://www.domainB.com
ProxyPassReverse / http://www.domainB.com
This can also be achieved with help of Mod_proxy_ajp & Mod_JK module.

Htaccess subdomain exceptions to rewriterule

I host in siteground, on a multiple domain account,
Main domain is pointed to public_html, so it's a bit dangerous for the rest of sites in the account to use it (unwanted deletes, hacks, and so...)
I successfully followed this guide (http://www.ianholden.com/how-to/hide-joomla-subdirectory/) to point mydomain.com to midomain.com/mydomain folder (joomla install)
But now I have a problem with existing subdomains for sites still without their own domain names, that give a 500 error when visited...
What could I use to leep my current rewrite rule mydomain.com -> mydomain.com/mydomain and make exceptions for subdomains as whatever.mydomain.com?
Thanks
The problem is that the rule that you have added to your .htaccess file will affect all other sites on your hosting account, since the .htaccess file is at the same level of all those sub-directories.
If you have too many sites hosted this way, then I suggest you go with a VPS, and then create an account for each and every domain that you have. This will ensure that your websites run smoothly and in silos.
Whatever you do to make Joomla work properly under a subdomain, will create problems for you on the long run.

Apache sites do not have http:// prefix in address bar

I've setup 4 sites on a LAMP stack and pointed a number of domains at the server. Everything is running nicely but for some reason, none of the sites have the http:// prefix.
It isn't a massive problem but down-the-line, these sites are going to run https on secure areas and I want visitors to be able to differentiate.
Why would Apache NOT display the http:// prefix? I'm using named virtual hosts and have modified my /etc/hosts file to point the relevant domains to my server's IP.
It's most likely the browser hiding the http:// prefix. It should be happening on every other web site you visit with that browser, too.
You can't control this with Apache - but don't worry, in https mode, the browser will make sure the user sees the difference.

What is the best technique for (seo-friendly) forwarding muliple domains to one web server?

The setup is:
www.domainA.com
www.domainB.com
both actually hosted on one web server (Apache)
123.123.123.123/domainA
123.123.123.123/domainB
I have setup a hidden forward from the domains to the web server directories which works fine, however, produces duplicate content (since it is also available by addressing the web server directly). I tried setting up 301 redirects to the domains for every request that is targeting the IP address directly (using mod_rewrite),but found that this results in a forwarding loop. Obviously the server does not recognize whether the domain has been requested originally.
If anybody can give me a hint on how this is supposed to be done, I'd be glad to hear.
You can set up virtual hosting on the web-server so that it does pay attention to the hostname that was requested. This is a fairly common practice and should solve your problem. You can do away with separate subdirectories since each virtual host has its own virtual root.
So are you saying that you have pages indexed in google that reference your IP address and a directory rather than the domain name?
Also, I'm not sure why doing a redirect from the IP to the domain name would cause a redirect loop. If the redirect is based on the host header, it should work fine.