Cakephp .htaccess : multiple domains pointing to one app - .htaccess

I am working on one cakePHP application.
Now i want to configure my main domain (www.example.com) to be accesses via 'www.xyz.com' or 'www.bcd.com'.
For this i will add the CName record in the 'www.xyz.com' or 'www.bcd.com' as 'www.example.com' then xys.com & bcd.com will point to the example.com.
But now on the xyz.com & bcd.com i can see the content of example.com, but whenever i click on any link it gives me 'URL NOT FOUND' Error.
So i tried lots of .htaccess rules but it is not working.
It is similar to the bloggers custom domain pointing. I need the same thing to be applied for my application.
Can anybody tried this before?

This isn't entirely an .htaccess issue - you need to first edit the server name in your web servers configuration file to serve not only example.com, but also requests coming in from xyz.com and bcd.com.

Related

Configure Subdomain with Heroku and Google domains?

I want to configure a subdomain on my main website. For example, www.something.com and something.com redirect to the same main website.
I want to add hi.something.com and for this, I used on my nodejs application vhost.
var vhost = require('vhost');
app.use(vhost('hi.something.com', require('./routes/hiIndex')));
//In (./routes/hiIndex) theres just an app.get telling it which page to render when it reaches this URL
When testing it locally, it works, but once I deploy my application to heroku and try to access hi.something.com it doesnt work, it redirect me to the main website, meaning something.com
Do I need to add some extra configuration, perhaps on the DNS settings for google domains or on Heroku?
If so, do I just point it to something.com ??
I have worked with redirect to other websites in form of subdomains but this is my first time trying to make it work from my own application.
You might have a subdomain catch-all redirect which prevents vhost in Node.js from picking up the subdomain. Try adding an A type record in your DNS settings that points to your Herokus server.

2 Different Servers - sub domain redirect url masking

I have gone through a lot of posts about .htaccess but its not working as my websites are on 2 different servers.
I have 2 websites, both are on different servers. One is on Linux Server and the other is on Windows Server.
My main website is hosted on the linux server. Lets call this abc.com
My other website is hosted on windows server - lets call this as xyz.com
I have created a sub domain on abc.com, subdomain.abc.com
I want to redirect subdomain.abc.com to xyz.com without changing the url which should remain as subdomain.abc.com. I have tried all sorts of combination in .htaccess but it does not work. Can you please help.
Thanks
VJ
Use an IFrame instead of trying to do this with htaccess files/code.
Using htaccess to redirect the page but keep the URL structure and change the domain only
Edit|Update: Use iframes and not frameset. See this w3schools tutorial page. Adding an iframe is very simple so keep everything very simple - http://www.w3schools.com/tags/tag_iframe.asp

Redirect www.subdomain domain mask to subdomain

I currently have subdomain.example.com as a domain mask for my website, using a CNAME record in my DNS settings. The website it is masking (lets call it mask.external.com) recognizes subdomain.example.com on its server and gives us a specific page.
My issue is that www.subdomain.example.com was bringing up a 404 'page not found', and after adding a CNAME record making www.subdomain.example.com as a second domain mask for mask.external.com, would simply give us a general page (not tailored to our website).
I was wondering if there was anything we could add (DNS records, .htaccess, etc) that would redirect www.subdomain.example.com to subdomain.example.com BEFORE it tried to visit this external service, so that we could properly serve it to users who type www.subdomain.example.com
Thanks in advance!
If you have cpanel then there might be an option in your cpanel to redirect subdomains to domain with and without a prefix "www".

Need Domain Name assistance - Please

I have a small issue. I have tried for the last hour to find a solution for this on this and many other websites. I have found similar but none have provided an answer that works. Heres that problem:
I have a badge on my website that was given to me by Norton online protection. they provided me with a script file and I placed it where it should go. NOW, this script is registered to "www.example.com" but if someone goes to their browsertypes in just "example.com" without the WWW. the Norton badge never shows.
I spoke with Godaddy this morning and they have no solution so that's why I'm asking on here.
Is there a to send a domiain name to the same domain name? so that it always shows the WWW?
Configure your webserver such that www.example.com is one site (your actual site with your content), and you have another site that is example.com (no www subdomain) as a site that you can now configure to redirect to your actual site. How that step is done depends on which webserver you are using, but basically these is a way to do that on any webserver (Apache, IIS, etc).
You could try to read the URL and check if 'www' is present in the URL. If it is not present redirect the visitors to www.example.com
In php you could use the below for redirection
header('Location: http://www.example.com/');

Subdomain mapping to another external subdomain

I'm trying to map help.domain1.com to help.domain2.com. I've seen this on UserVoice. They let you map something.yourdomain.com to something.uservoice.com.
On domain1.com I've set up a CNAME to help.domain2.com.
It works fine but when I open help.domain1.com I get the content of domain2.com instead of help.domain2.com.
After some experimenting I've realized that this is an expected behavior.
So my question is what do I have to do on domain2.com (or maybe on domain1.com?) to have it show content of subdomain "help.domain2.com" when I navigate help.domain1.com?
(I'm using Plesk and the OS is Windows Server 2003)
I was facing the same problem for the last couple of days, and just found the solution...
In /etc/apache2/site-available/default, I had two virtual hosts, first one was for my domain, and the second one was for my sub domain. All I had to do was reverse the order of the virtual host blocks, placing the sub domain in front of the domain, and it worked! :D
I found the solution. One way would be to use a mod_rewrite rule on domain2.com and do a redirect if referrer is domain1.com. Or to assign a dedicated IP address.
HTTP/1.1 uses the Host: header to figure out which site is being requested, should there be more than one site hosted on the same IP address.
You need to ensure that the second (target) web-server is configured to expect incoming HTTP requests with the original URI in them.
I am not 100% sure how to do this in windows but in apache you just need to setup a virtual host to redirect it from the main domain to your subdomain.
you do not say if you are using IIS or apache or what the webserver is.
I imagine that what you need to do is setup a new website in IIS (not a virtual directory) and in the website tab click on advanced and edit the entry in there so that the "host header name" is the subdomain you want.
Jon Hawkins

Resources