Two URLs, Same Server / Files? - dns

I would like to have two URL (ex: www.mycoolsite.com and www.myfunsite.com) and point them to the same server, and use some of the same files. I want a different homepage and css for each site, but evernthing else would be identical.
My webhost allows me to 'park' a domain, but that changes the URL that the user sees and I'm not sure if there is anyway to detect which URL the user originally entered.
Any ideas how this can be accomplished?

I think you want a HTTP 301 permanent redirect.
Example

Related

how to redirect to the specific url through htaccess

i have a website and i want that whenever someone types in the domain it should take it to the dedicated path that i chose for it like when someone types www.gdrfa.info it should take the user to www.gdrfa.info/portal/pls/portal/ and if someone changes the url like www.gdrfa.info/portal/pls or changes anything after.info then too it should automatically redirect to my desired url can anyone tell me how can i do it i searched on web but could not find out what i wanted.
I tried
Redirect 301 "/old-page.html" "http://www.new.com/new-page.html"

DNS redirect of a url to another url

We are currently looking at identifying the best approach to carry out a redirection of a url folder to another url folder o a separate domain. We have tried a few options but have been unable to make this work. Any other redirection options such as apache, html etc are not possible. This url is only accessed through the browser by an application to download some files. This application cannot be changed but needs to download these files from another location.
Hence, we need to redirect the following:
https://sub1.domain1.com/xyz
to
https://sub2.domain2.com/abc/xyz
Any ideas how we can achieve this?
Note: we have full control of DNS of the domain1 and there are no plans to use this domain.
You can't do that with DNS alone. The DNS never sees the "path" part of the URL. You need a webserver aware of the situation who can provide a 302 redirect.

redirect non existence url to folder

i am a user, and i type: www.japsomething.com, that url doesn't exist however there is a folder called "something" and i want this url to point to that folder?
do i need to purchase the domain name for this to work or i can use .htaccess?
i still would like to preserve the url. so this means, even though i am coming from
www.japsomething.com the url should still say www.japsomething.com and when i click anything on the site it should say www.japsomething.com/anything/
another question is, how can i detect based on the users ip that i want to show them a spanish site, or an english site?
thanks for your responses.
do i need to purchase the domain name for this to work or i can use .htaccess?
You need to purchase the domain name, because otherwise when someone types: www.japsomething.com, their DNS is going to try to look that name up, and if you don't own that domain, the request is never going to reach your server, thus, your htaccess file is never even used. Because you don't own every domain that starts with "jap" and ends with ".com", you can't use htaccess to do this.
i still would like to preserve the url. so this means, even though i am coming from www.japsomething.com the url should still say www.japsomething.com and when i click anything on the site it should say www.japsomething.com/anything/
If you own the "japsomething.com" domain, you simply point it to the server and directory that contains all the content, and then be done with it. No htaccess trickery is involved here. If you went out and bought the "japsomethingelse.com" domain, simply point it to the directory that serves that.
another question is, how can i detect based on the users ip that i want to show them a spanish site, or an english site?
See mod_geoip2 for downloads and examples.

view the real htaccessed link

how can i view the real URL without the functionality of .htaccess rewrite file ?
while using url rewrite with the .htaccess file you able to see sites like this :
example.com/i/154/b/6574534
i want to see the "source" of the url , such as
example.com/index.php?i=15&b=6574534
It sounds like you want to reverse the URL rewriting, without having server-level access to the server you are interested in. If this is the case, what you're asking for is not possible unless the server provides an API, a custom HTTP header in the response, another link on the page, or some other method to find the non-rewritten URL. The ability to do otherwise would defeat many purposes of URL rewriting.

Htaccess.. changing the domain name

I have a big Joomla website that was moved from .com to .eu domain.
The sites are on one web server.
On the old website there are a lot of links that point directly to oldwebsite.com/somethinghere.
Is there a way with Htaccess file in the old domains folder to redirect
from oldwebsite.com/somethinhere to newwebsite.eu/somethinghere?
Or maybe a way to do this on the new website folder?
Thank you,
Chris.
There are many ways, some people recommend using RewriteEngine, but there is an easier way:
Redirect 301 / http://domain.eu/
This will automatically handle files in the domain -- for example, old.com/foo will be redirected to new.eu/foo
EDIT: Regarding "301", that is the code for a permanent redirect. There also exist temporary redirects (I believe the code is 302), but it sounds like what you need is exactly this - a permanent redirect.
EDIT2: Oh and, I think the / after domain.eu may be required, but I'm not 100% sure - doesn't hurt for it to be there, that's for sure! I know that because I use the same kind of a redirect on a production website.

Resources