Forward domain with htaccess - .htaccess

I have 2 domains and I would like to make the first domain use the second domain, for example:
http://a.com
http://b.com
Now, when someone will access
b.com/test.php
it will actually use the file
a.com/test.php
but, it will not forward it and the domain will show
b.com/test.php
What's the best way to do it?
Thanks!

Related

Setting up domain alias CNAME record

I have a website setup at bryantmakesprog.10b3.com. I also own the domain sneaky.fish. I want my domain to point to this website by pointing to to the url, NOT the ip address. The end result being that visiting sneaky.fish/sample-page renders bryantmakesprog.10b3.com/sample-page but the URL says sneaky.fish/sample-page.
What would be the best way to go about this? I've seen some people have CNAMEs setup, but I'm not having any luck. Here's what I've tried:
To clarify, the domain must point to the subdomain. It is not sufficient to point to 10b3.com.
So there were two parts to this issue.
The first, the CNAMEs worked, it was just a matter of waiting.
The second issue was with the subdomain. sneaky.fish redirected to 10b3.com, and only bryantmakesprog.sneaky.fish would redirect to bryantmakesprog.10b3.com.
The solution for this was to use PHP to determine if a CNAME record exists pointing to bryantmakesprog.10b3.com and to handle that accordingly.

htaccess redirect from two domains

I have two domains, lets say www.A.com and www.B.com which are located on the same server. The directory is like this:
/html/index_of_A.php
/html/content_of_b/index_of_B.php
Now i want to configure an .hataccess file, which does the following things:
1) redirect users which enter A.com to /html/index_of_A.php (which is actually www.A.com) and
2) redirect users which enter B.com to /html/content_of_b/index_of_B.php
At the end, users enter two domain names (a.com and b.com) and they are getting redirected respectively to the specific folders of the domains.
Is that possible with htaccess?
The reason for this is, that i have two domain names, but they are on one server. Now I want to seperate both of them, to make "two different web pages".
Further, the users should always get rediretet to the www version.
Unfortunately I have no idea how to do that... I did some searches and tried different methods, but no success :(
Hope anybody can help me, appreciate that!
If I understand you problem correctly, there is no need to configure an .htaccess file.
You can solve your problem by slightly reorganizing your folder structure.
This is how I would solve it:
[folder for domain A/index.php]
[folder for domain B/index.php]
Configure your domain registration for www.A.com to point to [folder for domain A]
Configure your domain registration for www.B.com to point to [folder for domain B]
This way there is no need for an .htaccess file unless you are setting one up for security reasons (not redirection) AND you don't have to muddle through www.A.com's files when you need to focus on www.B.com.
I hope this helps.

Redirect while keeping URL in browser by DNS settings only - is it possible?

I had an argument with my friend about domain redirects. He is convinced that you can redirect one domain to another by using DNS records only, showing source URL in browser instead of target URL. I mean, without any access to webserver. I don't think this is the case but can't find a direct proof that it's impossible.
So I'm curious. Is there a way to do it?
Yes it's possible. It's sometimes called Stealth Forwarding and may or may not be offered by your domain name registrar.

Is it possible to create a domain with another word before the. and the rest of your URL? (Closed)

so basically I'm trying to make a secondary domain that is about.wyrnz.com and I was wondering if I have to buy another domain or if it is possible to do that without buying a new domain?
Thanks everyone for replying! I've worked it out now so this is now closed!
As soon as you own a second level domain (wyrnz.com), you can create as many sub-levels as you want. That includes third level (xxx.wyrnz.com), but also fourth (yyy.xxx.wyrnz.com) and as many levels you want.
That also depends on you host. I know that some hosts restricts the number of sub-domains you're allowed to create.
If www.wyrnz.com is your domain you should not have to buy another domain. In fact, you can not even buy it, you already own it. about.wyrnz.com is a subdomain of wyrnz.com.
What I did is:
Create a subfolder on the webserver, create a subdomain and point the subdomain to that folder. Every time someone types in about.wyrnz.com, the index page in the subfolder will be served to the user

Use htaccess mod_rewrite to hide domain name

I've read lots about what can be done with mod_rewrite but I haven't found one to solve my problem. Maybe it can't be done?
I have a sub-domain on my primary domain that I have a customer direct user to to use one of my programs. The customer doesn't want his customers to see that that are on my domain and he doesn't want to use an iframe.
So, is it possible for the user to only see www.subdomain/program.php instead of www.subdomain.mydomain.com/program.php?
If you want the browser to show www.subdomain/program.php in its location bar, you need to register the www.subdomain domain name. There is no way to remove bits of the domain name using anything in the htaccess file. For example, if you've registered example.com and you have a server at foo.example.com, and you want to be able to go to http://foo/some/path/index.html, you're out of luck because the browser is going to attempt to do a DNS lookup of foo and it will most likely fail unless there happens to be a "foo" server under the DNS search domain. Browsers put a great deal of effort to prevent spoofing of the domain name, since it would be really bad if I was able to spoof my website to show the domain of a bank in a browser's location bar while actually visiting an entirely different website.

Resources