Subdomain redirect to subdirectory - redirect

I have a domain in which I want the subdirectory to be shown as a subdomain in the url.
I do not want it to be a subdomain because it'll cause problems with the integration of two cms's that I have.
I would like
forum.domain.com -> domain.com/forum
to redirect to there but I would also like it to keep saying forum.domain.com in the url and not change to /forum.
I do have access to the DNS zones but I am completely lost on how to do this. So far my forum.domain.com is a website by itself in which I do not want it to be.
*Server Htaccess is running helicon ape.

This cannot be done purely through DNS. It's not hard, but it does involve your web server's configuration.
In DNS, create a CNAME (an alias) for forum.domain.com to point to your server, probably domain.com.
In your webserver's configuration, configure a new virtual host with that path as its document home. The way you do this will depend on whether you use Apache, Nginx, etc.

Related

custom domain mapping to subdomains

I have searched and have not been able to find anything helpful.
I have a mydomain.com that is setup to allow wildcard subdomains (*.mydomain.com).
I need to be able to have clientdomain.com point to clientdomain.mydomain.com.
I've setup a CNAME clientdomain.com > clientdomain.mydomain.com, though I get the standard CPANEL error page since clientdomain.com is not configured on that host.
I need to be able to do this on the fly - so I cannot ad a hostrecord for each domain, unless there is a way to do it programmatically.
CNAME record will not work as the parent and source domains are not hosted on the same server.
You will have to the redirection feature in cpanel to get this task done by creating proper subdomain. You can set the redirection through redirection option in cpanel.

DNS solution for someuser.com -> domain.com/some-user

Let's suppose there is a webpage where someone can create his own profile page.
His profile page is then available at
domain.com/some-user
Then, this user with profile domain.com/some-user, own his own domain
someuser.com
and he wants redirect from someuser.com -> domain.com/some-user
How can this be achieved?
I mean what DNS records must be set for someuser.com, and what web-server settings must be set on domain.com
Thanks
One possible solution is to redirect him to domain.com host, and via apache, redirect him to domain.com/some-user.
You can do it in several technologies as Java, Php, Ruby, Node, since it's a http header field (host), which you can read and do the processing that you want.
For instance, using apache configured to answer for someuser.com and .htaccess files it would be:
Redirect "/" "http://domain.com/some-user/"

IIS Redirects - Redirecting domain without website binding

I have a bunch of domains (50+), e.g. example1.org example2.org, example3.org that I would like to redirect (301) to a single domain, examplethebest.org. Nothing is hosted on any of these domains other than examplethebest.
I've set up all the example domains in the registrar's DNS to point to the IP of my web server.
I was wondering if redirecting these is something I could achieve via rewrites in the applicationHost.config file. Or do I need to add bindings for example1 - example3.org in examplethebest's website bindings?
Just wanted to add that I understand how to do the rewrites via the web.config in examplethebest if I add bindings for the domains I want to redirect, but would rather not have loads of domain bindings - e.g. what is best practice here? Thanks!
Okay so the issue I had on this particular web server was that the default website (listening to all requests on port 80) was stopped - the other websites all had specific bindings.
At least two possible solutions for this one:
Starting the default website and adding {http_host} rewrites in there
Creating another website, make it listen to all requests on port 80 with just a web.config and putting the {http_host} rewrites in there.
We went with option 2.

Drupal IP/domain redirect

I recently redid a client's old Drupal site, in Apostrophe, and pointed their domain to the new server.
I am now trying to access the old site via IP address, but there seems to be a redirect configured to rewrite the base IP address to the domain name (72.xx.xxx.xxx to www.clientdomain.com).
Is there something configured in Drupal to rewrite the IP address? Can I change a field in the database or configuration files to prevent this?
I have ssh access to the server, and have poured over the Drupal code, settings.php, .htaccess, etc., but cannot locate this offending field. I am not familiar with Drupal, but suspect it could be an admin setting. Since the site redirects, I am unable to login to the admin backend.
Any and all insight is appreciated. Thanks for your help!
A few possibilities:
In the settings.php (sites/default/settings.php), see if there is a $base_url set. If you can see any, comment that line. You can run a drupal site without the base_url hardcoded in the settings.php
In the .htaccess look for redirects. Your safest bet is to replace it with a fresh file downloaded from http://drupal.org/project/drupal
The most likely case is that your web server is configured to redirect the IP address to the main domain.
You can also access your site at old server by explicitly setting the IP address in your hosts file. Check it for your operating system DNS resolver docs.

Stopping the naked domain redirecting to www

i recently migrated my application to AWS and setup a cname for www.domain.com and a redirect for the domain.com to redirect to www.domain.com.
The problem is, an external service was using a path on the naked domain.com (something like domain.com/external/service/) But with the redirect all HTTP POST data is being dropped with the redirect and i cant change the url that the external service is calling.
To fix this, i have setup my naked domain on route53 to point to my elastic load balancer where my app is located. I set up an A record pointed at my elastic load balancer using an alias.
Its been two days now and my naked domain still redirects to www. and therefore the external service is down. Any ideas on what i could do?
I am taking a long shot - there are different possible problems:
You are forwarding naked domain via A record to ELB, but your EC2 instace (say Apache) is still doing a redirect (not DNS, but http 301) back to www.
Check the DNS TTL. If the TTL is too large (say 48 hrs), then it takes that time. You need to wait longer.
Is Route53 fully managing your DNS? One possibility is that, somebody else like Godaddy is still doing the DNS for you - so nobody is contacting Route53 for the change to reflect.