If I have a website with the domain someone.com which is the main site and two other domains mything.com and yourthing.com. All domains point to the same IP and the same path on the server.
When i go to someone.com, index.php is loaded and but when I visit mything.com and yourthing.com i want index.php loaded with a parameter like:
index.php?site=mything.com
In the code i'll identify which domain it is and load the relevant data.
In the address bar at the client I want the entered domain name to remain.
How can I achieve this with htaccess?
Cheers...
Found a solution, using the $_SERVER vars and some nifty apache setup.
Related
It's hard to explain, I would like to do something like below but I don't know how.
I currently own two different domain names and have one website.
Can I have two domains pointing to the same website but the URL only shows whatever domain is entered in the first place?
For example, when I type in 'domain123.com', it takes me to my website (IP address 111.222.333) with the URL shown as 'domain123.com'. Then when I type in 'domainABC.com', it also takes me to the same website (IP address 111.222.333), but the URL needs to show 'domainABC.com' instead of 'domain123.com'.
I guess I will need to redirect one of the two domains to the website, but how can I stop the URL changes the domain name?
I am not sure if I can just modify .htaccess to achieve above or if I also need to change the DNS, etc. to make this work.
Please help and many thanks
It depends on your setup and your server permissions.
A nice way will be to change the docroot in the apache or nginx config.
If you don't have permissions to edit these configs, you can create a symbolic links so that the public folder of domain2 points to the public folder of domain1
Is there any DNS or .htaccess (or combination of a two) solution for this type of redirection:
blog.mydomain.com point to medium.com/my-publication
And yes I am trying to apply this specifically to medium.com publication so if SSL certification or any other environmental conditions are relevant you check how it handles it. I have full control of my domain on the other side.
I am looking preferably into DNS solution because I will not be able to test .htaccess for a while.
Well, as far as I know the only relevant DNS record would be a CNAME record, and it would only allow redirecting the entire subdomain to medium.com.
NAME TYPE VALUE
-------------------------------------------
blog.mydomain.com. CNAME medium.com.
To redirect to a specific URL, .htaccess would be needed, or a webserver that returns a redirect. If it were me, I'd setup a redirect for that specific article:
blog.mydomain.com/my-publication => medium.com/my-publication
But this requires a webserver being setup at blog.mydomain.com.
Hi is it possible to stealth redirect a domain to another domain and in the meanwhile keeping the url of the first domain visible in the address bar?
Using cPanel and able to edit htaccess
I am not sure that this is possible, but you can instead do the following:
Use iframe in order to display the destination website inside your current website in "full screen". Read this for more information.
Point your domain name to the ip of the destination. This might not work if the destination uses virtual host, but you can try. Try using the same the sub-domain if this doesn't work.
I have a parked domain www.my-domain.com
I also have a hosted active domain sub.active-domain.com
I want to forward www.my-domain.com to sub.active-domain.com but keeps the url on
structure in the browser from sub.active-domain.com
example:
sub.active-domain.com/content/market.html
will shows on url become
www.my-domain.com/content/market.html
how to do it thru the htaccess file ? or should i do it thru the DNS or CNAME ?
The best way would be with .htaccess.
But you can not keep the url as long as you redirect it somewhere.
Or other wise use a iframe.
We're looking at running bigcommerce for a website and they have the ability to run the store using your primary domain url (which we don't want to do) or a subdomain. We wanted to have for eg: http://www.ourwebsite.com/shop.
Bigcommerce doesn't have the capability of us running it on a subdirectory, aside from a subdomain.
Can we with dns records point our subdirectory as above to load contents from our subdomain? If so, how?
ie: http://shop.ourwebsite.com/ contents displayed on http://www.ourwebsite.com/shop
We also have to use cname records to make our shop.ourwebsite.com subdomain load the contents from bigcommerce (I assume this is how it's done using your own url rather than their own yoururl.bigcommerce.com url).
We need to ensure this can still remain in place and it doesn't affect the above change we require.
Thanks!
You can:
Use mod_proxy this way your url stays the same (available through mod_rewirte [P] flag).
Redirect to your subdomain (html-meta, htaccess/http reply 301/302, frameset/iframe which is really ugly)
But with pure DNS, it's not possible.
CNAME DNS entries are just aliases for other domains, but can't handle directory structures.