In this article, we will show you several ways to redirect a domain to another URL, without changing the domain. While this is not a typical setup, there may be instances when this is needed. Follow along and we’ll explain several scenarios and provide example codes you can use to redirect a domain without changing the domain.
The first option will show all of the same content on one URL as you would another. For example, if you just changed your domain to DomainB.com, but you still have plenty of visitors coming to DomainA.com, you would use this to show them all of the existing content that is located on the new domain, without the need to update both websites.
To do this, you would modify your .htaccess file for the domain that your users will go to, and insert these lines of code:
If you are using the file manager in cPanel, be sure that you have the option to show hidden files selected.
Warning: If using this option, search engines such as Google or Bing will see multiple sites with the same content and can cause ranking drops in one, or both of the sites. From an SEO standpoint, your best option is to create 301 redirects instead.
What does the above redirect do? After adding this line into your .htaccess file, you will be able to go to DomainA.com/YourPage and it will show the content from DomainB.com/YourPage
Redirect a domain to a specific url
There is another way you can do your redirect to show a specific URL, but keep the domain the same as well. If you want visitors to go to DomainA.com with a specific page in mind when doing so, you may use this code:
You would use this method if, for example, you had an external blog such as one on blogspot.com or maybe a shopping cart on etsy.com that you want people to visit your domain without fully hosting the domain there. Now, visitors can access your site using your domain, but see the content of an external URL.
Warning: If you are using this option and absolute links on your site (meaning your links go to the full URL and not just an individual file) any links will go to the original site that is associated with that link.
Redirect an IP address
Occasionally, there will be a request to re-direct an IP address to a specific URL. The following code shows how this can be done in the .htaccess file.
# Redirect all IP address (replace the ## with the IP address numerals) to same https://domain_name.com
RewriteCond %{HTTP_HOST} ^##.##.##.##
RewriteRule (.*) https://domain_name.com/$1 [R=301,L]
No matter if you're a developer, system administrator, or simply a fan of SSH and command line, InMotion's Cloud Hosting plans provide a fast, scalable environment that is budget-friendly.
JB
John-Paul BrionesContent Writer II
John-Paul is an Electronics Engineer that spent most of his career in IT. He has been a Technical Writer for InMotion since 2013.
I’m trying to figure out the feature or the term used in a proxy. e.g. I enter www.somedomain.com/test but the proxy redirects it to www.somedomain.com. What happens behind the scenes, in this case
I think you’re talking about an alias or redirect . It’s basically redirecting or rewriting the URL to another location. You can set up a redirect in an InMotion account using the cPanel. There are a few types of redirects – permanent and temporary. Search engines often place importance on redirects, so it’s important that you use them correctly. You can use this article for more information on creating permanent redirects.
Hi I have a WordPress theme for which multiple installation is allowed only on subdomains. I have this theme installed for several subdomains and I want to access these subdomains using unique domains name for each of them however I want to keep the subdomain URL masked. Kindly suggest which method should I use avoid infringing upon the only subdomain installation requirement of the theme. Thankyou
Thanks for asking about masking your subdomain URL. InMotion Hosting does not support domain masking with its hosting service. Also, if you’re limited to use subdomains for a theme, then you should not be using unique domain names to access the site since the theme is limited to a specific domain. You will need to check with the theme provider for further support with this issue.
If that code is not yours, then you should remove it. Additionally, please make sure to check your .htaccess file. You can see more information about cleaning up an .htaccess hack in this article. We cannot change your website code for you through the Support Center. If you require further coding assistance, then you should consult with an experienced web developer.
My website www.klecbahubli.org has been redicted to one of the spammy website(www.mersinhabercs.com), I am unable to find the code also to remove, Kindly help me to resolve the same.
When I am checking my website in google webmaster, I am finding the below code in header section of my website.
We need to redirect the URL from www.basics.com/cyber to www.life.com/cyber.But the URL dont change to www.life.com/cyber and it will show the content for www.life.com/cyber.I mean URL masking.We have tried below code but it is not working
You can use a 301 redirect, but replacing an existing domain name with another domain name to mask the origination of the link is not something we typically allow in our hosting service. If you are not hosting with our service, then you may need to consult with your host’s service to understand how this may be done.
Can you please help me? I have a wordpress site, https://mydomain.com and created almost all of my redirects on cPanel via subfolders, https://mydomain.com/dir and so on. They’re all been working fine until a week ago when all of my redirects point to a 404 page. I tried undoing my domain’s htaccess file, having it on its default code and it kinda worked at first. But when I refreshed my browser, it then again redirected to a 404 page. What could be the issue here? I hope you guys can help me. Thanks.
I do not recommend adding codes directly to your .htaccess file since it can interfere with your website. This is because WordPress also relies on .htaccess rules. Instead, try using a clean WordPress .htaccess file and use a plugin to 301 redirect the broken links (there are many plugins available such as redirection).
I believe this message is indicating that content has been identified on the domain, that does not comply with the standards and regulations set forth by the Department of Telecommunications . Typically this is due to the presence of copy-written media. A redirect may resolve this issue, however, the government may restrict access to the new domain it is redirected to, if the same content is detected.
Instead of circumventing the government’s regulations, I suggest you remove the content or contact the Department of Telecommunications to discuss the matter and proper steps to become compliant. They may also be able to provide further insight into why the domain is being blocked. I hope this helps!
Zebra One Gallery – Art Gallery, Contemporary art, fine art, urban art, photography, mixed media art Zebra One Gallery – Art Gallery, Contemporary art, fine art, urban art, photography, mixed media art
Thanks for the question in regards to the canonical URL. Canonical URLs are used to tell search engines about URLs that are identical. This often happens with product URLs where different products are accessible under the same URL. If you want a decent tutorial on it, please see rel=canonical – the ultimate guide.
If you have any further questions or comments, please let us know.
We’re not sure what you are asking. Can you please explain the problem? If you can also provide the code, then we can look into the issue in more depth.
I have configured my domain name in Amazon Route 53 and the domain is redirecting correctly to the EC2 instance where my site is hosted. But the URL changes to the one in the EC2 instance.
so, when I hit – www.example.com, it goes to my Ec2, but url changes to https://ec2-instance-exmaple.com
how can we do to keep my domain name(www.example.com) visible in the URL?
Hi, I am glad, you wrote a very usefull information here. I have one question. My Old website *****.in and I redirected this site to new url https://*****.com/blog . When I open old site I redirected to new webaddress, but other pages are still opening in old url.
For example: https://*****.in/how-to-update-and-upgrade-kali-linux-to-latest-version/
What should I do to redirect each and every page to my new site.
am able to url forward to other ip based application. but i cant restrict the application to open by ip address apart from domain name. how can i restrict users to open ip based url
Srinivas, making an IP address load a webpage directly is a server-level change. Please also keep in mind that loading a website from an IP is generally a bad idea. You would need to talk to your server administrator for enabling such a feature.
Hi i am redirecting my pages that are not found to error404.php. For example my URL is www.example.com/Products and User type www.example.com/Product Then the page will be redirected to error404.php and URL becomes www.example.com/error404. Its annoying for user to write the same URL again and correct error. I want to redirect my page to error404.php but i want to keep URL same the user typed whether it is right or wrong…Thanks
I use DomainB to host sites that are being developed. For example www.DomainB.com/dir/dir/. I was trying to use a simple subdomain such as demo.DomainB.com to point to the area. SEO is not really an issue.
Once the project is complete, it will be moved to its new host.
Rick, it sounds like you just need to add the domain rapromos.net to your Apache configuration so that it points to the same folder that redfoxrap.com/rapromos.Is points to. If you have cPanel, this is a very simple process that you can do when you add the new domain by changing the value for the document root.
Ok I have been trying to get this working and I am confused. Been trying to find a solution in the comments but not finding what I need so decided to ask a question. My client has his domain in one registrar, but I made him a site on my registrar because he wanted the cheap deal from mine. We are trying to get it where instead of the host domain urls to be used… using the domain from his registrar.
For instance, domain he wants is https://rapromos.net… but the site is hosted under https://redfoxrap.com/rapromos.
Is there any way to make it so the links on the wordpress site here reflect the domain he wants? I tried the .htaccess methods with no luck. I currently have forwarding in place for rapromos.net to point to the site and mask it. However all of the links on the site still show redfoxrap.com/rapromos. Is there a way to mask this?
It’s possible that they can conflict. Directives in .htaccess are read from the top down. So, just make sure that you put what you want to happen first at the top.
If you have any further questions, please let us know.
Yes, in theory, what you are asking is the first option. However, its not very wise to do so. Google will see the content on the domain as duplicate and penalize you or worse, remove the sites from their search results altogether. The bigger question is, what are you trying to accomplish by having two different domains share the same content? Maybe there’s another, more appropriate, solution.
I have 2 websites, MyCreditLead.com has all of our content… but we wanted a domain name that matches our business name = CreditGuardUSA.com.
So, we want our site visitors to go to CreditGuardUSA.com but land on MyCreditLead.com…. which I have already setup as a 301 redirect. But my site visitors are seeing it change to https://mycreditlead.com, when we need them to see https://CreditGuardUSA.com in the URL.
How do I fix this? Please remember I do not have any content on the CreditGuardUSA site.
And will Google be okay with us showing CreditGuardUSA.com in the address bar, yet displaying content for MyCreditLead.com?
With cPanel, a domain that is set up as ‘parked’ to the main domain will keep the domain name typed in the browser window. Example: setting CreditguardUSA.com as a parked domain to MyCreditLead.com should keep CreditguardUSA.com in the browser. This only works with the primary domain name and will not work with any addon domains. The others will simply switch the names in the browser. This may or may not change with different cPanel versions.
What you are asking is called ‘masking’ and, other than the behavior in cPanel, we do not do. Since you gave the domain a 301 redirect, Google will be fine with it as a 301 says you mean to have the redirect set up permanently.
It looks like there is no easy way to redirect 8080 over proxy and to disable HTTP, as almost everything we put after this – like its ignored or create 500 error.
RewriteRule ^(.*) https://localhost:8080/$1 [P]
We can’t edit httpd.conf on managed so looks like we need to edit all that over htaccess, to redirect GlassFish to be over HTTPS and to use Proxy with .htaccess
Can you help me with a htaccess code for below situation:
I have domain.com stored on the host server in a subfolder. If I type in browser domain.com/subfolder I can access my site but I want to type just domain.com and after redirection will made, I want to still see on browser domain.com not domain.com/subfolder
You do not need an .htaccess code for this situation if you are designating a specific domain name (not the primary domain created for the account) for the subfolder. You can use an Add-on domain. Add-on domains are saved in separate folders in the account (typically subfolders), but still recognized as individual websites based on a specific domain name. So, if you have public_html/exampledomain where the Exampledomain folder is also the root folder for exampledomain.com, then you can set up the addon domain and it will be seen by viewers as a separate website.
I hope this helps to answer your question, please let us know if you require any further assistance.
It’s an expired domain and has links from twitter/fb, many other sources. Now when someone clocks a link on let’s say twitter – like this – fun140.com/quizz-online-game-7997/ it leads them to bestuscasinos.org/quizz-online-game-7997/ ….and there are hundreds of such urls on old site that are linked so I don’t know what to do..
Please let me know if it’s possible to 301 all those inner(and deleted) urls to the homepage of fun140.com somehow and then 301 fun140.com to bestuscasinos.org so that I dont get 404 errors ..
The re-write rule can be used for a 301 redirect. For more information on using a re-write rule, check out this Setting up a permanent 301 redirect via .htaccess. You will need to setup a rule to replace the the old URL with the new one in your .htaccess file.
If you have any further questions or comments, please let us know.
Please find below the htaccess I’m using. The homepage of old site redirects alright to the new site but the old urls(indexed/linked from other sites) do not point to the homepage of new site.
I want to 301 redirect all the inner pages of a website to the homepage of other website. Could you please let me know the htaccess code for this? Right now the old(and removed) urls from old site are casuing tons of 404 errors on new site, because oldsite.com/gamepage/ is returning error on newsite.com/gamepage/ ….. it’s not possible for me to put all the exact urls on new site thats why the problem.
Well concerning example 3, I want to redirect specific IPs on Domain, “A”, and if User IPS do not match with assigned IP’s, the user should be redirected to Domain B. Can you help regarding this in context of coding. Actually i want to add “Not” condition in RewriteCond %{HTTP_HOST} ^##\.##\.##\.##
Doesn’t this in effect create two twin sites which would split my Google hits and traffic between the two? I just want one site that people are directed to from either URL.
I just signed up for hosting with Inmotion. I purchased two domain names: “example.com” as my main domain as well as “theexample.com” just in case anybody assumes the “the”. How do I arrange it so that “theexample.com” sends people to “example.com” without having duplicate websites?
Well, my hosting company told me that I could not redirect from a shared hosting environment, which is why I wrote what I wrote. Sorry about that. When I did write a redirect it shut my site down and threw up a 500 internal error code. I did the comment line then
One thing none of you have ever mentioned which tends to make it really annoying for those on shared hosting packages is that these solutions with .htaccess files do not work for domains that are on shared hosting environments. I have spent a good few hours today trying to redirect a specific file in a specific directory to another specific file on another domain I own which is hosted elswhere. I have my reasons for doing this which I will not get into here, suffice to say I wouldn’t try doing this if I didn’t absolutely need to. So, don’t go assuming that everyone is on a dedicated server. But maybe the above post was written for this specific company (inmotionhsoting.com) where people do not have shared hosting. If that is the case please make that obvious.
Hello cas,
The .htaccess file was created to allow configuration changes on a cPanel account level, for those who do not have access to higher server functions. The .htaccess file is perfectly suited for shared. It is most definitely not only for use on a dedicated server.
Most of our customers are on shared servers and use .htaccess functions to do things such as redirects or rewrites.
Our redirect articles are all based on .htaccess re-directs, so you would need to reference outside posts for this information. Check out this post as an example. If you have any further questions or comments, please let us know.
It looks like you’re trying to re-direct someone to a different location but showing the same domain name as before. That is called masking and we don’t have any tutorials for that, unfortunately. You may be able to find ways to do it by performing a search on the issue in your favorite search engine.
If you have any further questions or comments, please let us know.
Very interesting post! My question is: Where is the htaccess file (to be) located? Background: I have some drupal test sites in /var/www/html/folder1 /var/www/html/folder2, … on an Amazon EC2 instance (linux)
For me example 2 would fit, I think. I want to redirect from mydomain.com to amazon-ip/folder2
There is an htaccess-file in each of these folders but I think these are not the files to be modified, right? Is there some kind of top-level htaccess file?
I’m operating as a distributor for a company, and they have provided me with a subdomain and a website template which is hosted on their main website.
I’m concerned about my SEO ranking by using a subdomain and want to use my own personal domain; however, I’d still like to retain the company’s template.
Can I redirect to their subdomain?
And would the SEO still perform poorly as it’s redirected to the subdomain?
I have a DOMAIN NAME A point to another server with https://domainB/subfolder, my .htaccess redirect is ok but in the browser after that display “https://www.domainB/subfolder”
I need to keep ONLY DOMAIN NAME A in my browser even the real content is pointing to hostingB, i was trying 3 days searching google and testing and i can´t.
Thank you for posting your question about redirects. I’m happy to assist you. Unfortunately, what you are trying to do is not possible. Once the htaccess redirect send the visitor to the other site, they are on that server and you have no control over it. Any further actions would have to be handled on the other site. However, if both sites were on the same server, you could set up a parked domain.
I hope this helps! Let us know if you have any further questions.
Thank you for contacting us. You should be able to accomplish this using the Proxy flag in mod_rewrite, here is a link to some detailed information on Using mod_rewrite for Proxying.
You will have to custom-code/develop a working solution. If you need assistance, I recommend consulting a developer.
This method will not mask the URL. When the redirect happens it will display the final URL. As we do not allow masking on our servers, we do not have any code available that does that.
Hi, If I have a domain something like “abc.com” and I started my work on a subdomain “site.abc.com” now I want to mask the site.abc.com to show abc.com…?
I posted a question and got an email that says I got a reply from Scott yesterday. Today I come to find it and answer his questions and both question and answer are gone? I’m confused.
Lots of comments and lots of different solutions…so much that I’m a bit lost. Plus there’s a twist to my situation with email.
I have domainA.com which is built on OpenCart and actually my primary domain. I wanted to switch to WordPress and built domainB.com on WP. Same products, different platforms and totally different url setup.
I tried simply forwarding the domain but as we know, it changes url and email stops working.
What is the best way to forward domainA to domainB without losing email and keeping the domainA.com in the url? I know it has something to do with changing mx record in the domain registar(GoDaddy) but not sure what. Also, which method above is going to not hurt my seo?
Thank you for the assistance, it is much appreciated.
I’m a bit lost on what you are trying to accomplish. I understand the DomainA to DomainB redirect. That can be accomplished via the cPanel. After the redirect, you will not have DomainA in the URL, that is the point of a redirect. These redirects do not affect the way emails work or are delivered.
If you are referring to how to log into the webmail section (domainA.com/webmail switching to domainB.com/webmail) then that is only a visual change in the address bad and will not affect the emails.
The URL portion of the webmail is not important as long as it points to the right server and you can simply use the Temp URL webmail login URL if you like. You can find that URL within your AMP settings.
I am using an advertisement service that shows my content as https://domain.com/folder/shortcode (like https://domain.com/folder/abc12)
My intention is to setup a subdomain https://sub.mydomain.com and redirect every advertisement shortcode from my sub domain to the actual page, like this:
I tried your setup and replaced the content of the .htaccess file with this: (Please note the missing $, I removed it since you don’t use it in your examples. Doesn’t work with or witout it)
I am trying to do example 2 but I can’t get it to work right.
I want to move visitors of sub.Domain1.com to https://domain2/folder/script.php, all while showing sub.Domain1.com on the url, and keeping SSL padlock in place *(Domain2.com has an SSL certificate, and Domain1 has flex SSL with cloudflare).
I know this is possible, because I have seen it done before with my setup above. I am just trying to figure out how. I would greatly appreciate any help. Thank you!
Suggestion #2 may not be what you are looking for because that method will change the url completely and not display sub.domain1.com. Please also make sure that the following is inside your .htaccess above your re-writes.
I would like to redirect DomainA/folder1 to DomainB/folder1. I placed the .htaccess with the code under folder of my web-address (DomainA). I tried both methods of redirecting, but I’m getting a 403 Forbidden error. I checked both the DomainA/folder1 and the DomainB/folder1 permissions and they are both readable and executable for everyone (rwxr-xr-x). The .htaccess file itself has 644 permissions (but I tried also with 777 and it didn’t work). What else could I look at?
It sounds like everything should work though I cannot see the specifics of your account. If you are one of our customers and still have issues, you may want to contact Live Support so they can further assist with any individual problems.
Hi John-Paul. Thank you very much for your reply. Now the following part of my question would be:
If I have Domain1 with an official SSL certificate and Domain2 (on another machine) with a self signed SSL certificate, and I set up an .htaccess file the way explained here, will a browser calling Domain1 via https receive a message saying that the server can’t be trusted, as it normally happens by directly calling a server that has a self-signed SSL certificate?
Basically what I’m trying to do is the following: I have Domain1 hosted by an external company, where the web site is hosted, and I can’t install software on that machine. I have a dynamic dns Domain2 to my own computer where I can install all the software I want. I would like my customers to call Domain1/directory1 and receive the response from my computer (Domain2/directory2) where the software actually runs. However I would like to install the SSL certificate to secure the connection only on one computer, if that’s possible.
SSL certificates are dedicated to a particular URL set (www and the non-www version of the URL). If you’re going to be re-directing to another computer with a different URL, then the URL without the certificate would not be secured by the SSL certificate. The computer you’re not able to install will have a secure connection as long as you’re getting to that computer with the URL specified within the SSL certificate.
You may try using a variation of scenario 2 above. However since you are using aspx files, you may be on a Windows server. We are not able to advise on IIS or how it is particularly set up as we have no Windows servers.
Hello, first of all let me compliment you for the very helpful tutorial and answers. I have a question that I didn’t see here.
Let’s say I have Domain1.com and I want to redirect it to Domain2.com. If Domain1.com has an SSL Certificate and is addressed via HTTPS, will the connection to Domain2.com be encrypted even if Domain2.com doesn’t directly have a certificate?
Also, I’m assuming in the rules it would have to be specified that the redirected domain is an HTTPS and the target domain is a normal HTTP, right?
Helping me with this redirect would be of great help. Its been long time since I am trying to find a solution.
My wordpress site fashiontiptop.com. It is a amazon affiliate site.
When I click buy now button on each post (for example: https://www.fashiontiptop.com/volcom-mens-frickin-modern-stretch-short ) it should go to this page ( https://www.fashiontiptop.com/thanks/ ) and after 1 second it should redirect to the respective amazon product page.
This is not something that can be accomplished with a small change to an htaccess file. The thank you page would need to capture the original URL that the visitor came from and then redirect to the proper Amazon page. This can certainly be done with proper coding, however.
I am not aware of a possible way to accomplish this with an .htaccess redirect. The only way I know to do this is if domainB.com is your Primary domain, and you Park domainA.com in your cPanel.
I have a domain domainA.com which will redirect to domainB.com without any issues. But when the redirection happens i dont want the users to see domainB.com in the browser, i still want it domainA.com. Here is the code i have.
Hi- I’m having trouble with these solutions listed – so I want to make sure I’m doing everything correctly. Here is my scenario:
I have a landing page at www.domainA.com/landingpage.
I have a domain at www.domainB.com
When I have a visitor go to www.domainB.com, I want them to see the content on domainA.com/landingpage, but see www.domainB.com in their address bar/url bar.
Is that something that can be done with one of these solutions?
Using the second option above should meet your needs. You’re basically re-directing to domainA.com/landpage (a specific URL) without changing the URL in the address bar.
I hope this helps to answer your question, please let us know if you require any further assistance.
I would like to redirect domainA.com.sg to domainB.com/subdirectory. I don’t want to change the URL to “domainB.com/subdirectory” when I access domainA.com.sg.
Sorry for the continued issues with the re-writes. You may want to check out the code provided in this forum: Dynamic subddomain with htaccess. The answer provides code that you can modify for your purposes.
If you have any further questions or comments, please let us know.
Thanks for the question. The point of this article is changing the URL using a rewrite in the .htaccess so that you can use a different URL from the original. The original URL is re-written, to the new URL you want to use and then any subsequent path will go to that URL. If you were to change the path for your website, the subdirectories for the website should exist at that domain. Otherwise, you will get a 404 (page not found error). You would need to make sure that the files for your website are in the path that you are changing it to. For example, the default root folder for InMotion Hosting’s websites is public_html. If the primary domain is retailB.com, then files would not be located in that location because the website was built elsewhere (under the location for retailB.com). You would need to copy the files to the public_html (for retailA.com) and then use a re-write rule (as per above), so that anytime types the URL, then they would be getting to a web page that exists at that location. I hope that makes sense for you.
If you have any further questions or comments, please let us know.
My domain for example is retailA.com. I commissioned a provider to create me a new page and they assigned a different domain retailB.com. The new page/domain has subsequent/inner pages.
Now, i want for my homepage (retailA.com) to look like retailB.com withouth having to change my url to retailB.com. My question is, how will any of the solutions (especially solution 1 and 2) affect the inner pages of retailB.com?
I have several domains parked with inmotion hosting. I want to forward these to my hosted domain of sacredpostures.com. I don’t see an option to do this for parked domains without cpanel logins. Can you help?
This is a surprisingly confusing writeup. It could be much clearer.
Ex 1: “keep everything after the URL”.
There is nothing after the URL. Not in that example, or in any example. The whole thing is the URL. I assume he means to say the domain name or the TLD.
Ex 2: “redirect to show a specific URL, but keep the domain the same as well”
The example proceeds to show two different domains – DomainA and DomainB. The above text stating that this example was to “keep the domain the same” is very confusing. This example has nothing to do with keeping the domains the same, and they are not the same.
It goes on to give a use case where “you had an external blog such as one on blogspot.com”. This is the past tense – you had an external blog. But reading it through suggests he means a blog that you have right now, which is the opposite. It’s just so confusing. This could be so much clearer for people.
Thank you for pointing these issues out, I will see to have them addressed. However just so everyone is clear that comes across this in the future. This article is giving an example of you having myblog.blogspot.com and you want myblog.com to point to myblog.blogspot.com.
Hello my case is as follows .
Not a mudandança domain but subfolder.
example:
I need that when the page :
domain.com.br/baixar-modelo-pagina-facebook-2015
is accessed , the page content is displayed :
domain.com.br/landingpages/template_fb2015/baixar-modelo-pagina-facebook-2015.php
I did some testing but all I can is to redirect the URL domain.com.br/landingpages/template_fb2015/baixar-modelo-pagina-facebook-2015.php
to domain.com.br/baixar-modelo-pagina-facebook-2015
but occurs 404 .
Can you help?
It is difficult to say right off hand. If you are using a CMS of some sort, they tend to have their own redirects and rewrites also involved. The .htaccess file is read from the top down, so there could be other rules involved as well.
Upon bouncing I’m getting this error for mail delivery failure
This email is being returned to you because the remote server would not or could not accept the message. The registeredsite servers are just reporting to you what happened and are not the source of the problem.
The address which was undeliverable is in the section labeled: “—– The following addresses had permanent fatal errors —–“.
The reason your mail is being returned to you is in the section labeled: “—– Transcript of Session Follows —–“.
Thanks for contacting us. At the time I looked up the MX records for the domain.in, it was:
10 inbound.Domain.in.netsolmail.net
Wherever the email is hosted, just use their specific MX record settings. If you are not sure what they should be, the email host should be able to provide them to you.
We are happy to help further, but will need to review the bounce messages to help narrow down the problem.
Also, our bounceback parser tool can help determine the cause of returned/bounced messages.
Thank you for contacting us. Your Email Routing setting for domain.in, should be set to Remote Mail Exchanger. Since the email is not handled on our servers.
Yes, you absolutely want to delete the following record:
0 domain.in
This will override all other MX entries, since the zero (0) record is used first, when attempting to deliver mail.
Okay what i’ve done is changed Domain.in as the primary domain (just clarifying since we were using dummy domain Domain.com as primary domain) and Domain.co is anyway the add-on domain, and inside the cPanel i’ve set the redirect from Domain.in to Domain.co in IMH panel.
I’ve also updated MX records for Domain.in as you advised, and now i don’t think i need to again do the .htaccess redirect since it’s already taken care of.
So, after leaving a gap of few hours, I think i should simply update the nameservers of Domain.in to NS.InmotionHosting.com and NS2.inmotionhosting.com
Am i correct or still missing something here?
May i also request you to edit my comments and replace Domain with Domain, Registrar1 with Registrar 1, and Registrar2 with Registrar 2 because i don’t want this to be publicly posted forever – just posted exact things to help you understand the exact problem.
Yes, that sounds like your solution should work fine. This way the .in will display .co, but the MX records for .in should keep mail as it is. Once pointed to our name servers, then everything should work as you desire.
Nope actually i used the “Domain Forwarding” option on Registrar1 domain panel. Regsitrar2 panel sucks and I can’t access .htaccess file over there, nor able to set a domain forwarding instruction from there either.
When i see domains under my Network Solutions account, it shows EMPTY, which is also baffling me out, and only landing page files are uploaded via FTP and the email is setup.
Now without touching Domain.in emails, can i somehow forward Domain.in to Domain.co so that if anybody visits Domain.in he/she sees contents of Domain.co (I’m not worried about any masking – 302 redirect will do)
I looked up both your domains, and they are both registered with Registar1. This is most likely why it is not listed with Registrar2, but is really just a guess.
There are several ways to accomplish this, but this is the most common way:
Add Domain.in to your cPanel as an Addon Domain.
Create the following MX record for Domain.in:
10 inbound.Domain.in.netsolmail.net
Allow up to 24 hours for this update to propagate.
Finally, point Domain.in to the Nameservers for InMotion Hosting. Within 24 hours the domain will be redirected to your Domain.co website. Email should continue working, since we already set the MX records up previously.
No John i don’t want Domain.in mails to be hosted where Domain.co is!
I want Domain.in mails to be “AS THEY ARE” untouched, and just redirect/forward visitors from Domain.in to Domain.co (which is hosted on IMH and up-and-running as expected with separate mail server and everything)
Both domains are registered with Registrar1, Domain.in hosted with Registrar2, Domain.co hosted with InMotion.
I tried setting up domain forwarding on Registrar1 Domain.in to Domain.co but Domain.in is still displaying old contents of the website despite waiting for over 24 hrs. So, i don’t think domain propagation is happening.
We have a domain Domain.in on Registrar1, hosted with Registarar2 with a landing page but emails configured, and now wish to just redirect the same to Domain.co, without disturbing the mails and letting them be hosted with Network Solutions.
I’ve just set a domain forwarder from Domain.in to Domain.co in Registrar1, and Domain.co is hosted with InMotion but registered on Registrar1 and is working fine since I’ve set the Name Servers to point to IMH.
However, if i point the nameservers on Domain.in also, then it screws up the MX records and mail propagation.
Am i doing something wrong – should i do anything else except the domain forwarding?
How do you redirect ALL other domains to a new domain? These example reference how to redirect a domin if you know the domain that will be used first.. What if you don’t know the domain, or have too many to add/update?
It is a much better idea to add each domain that you are redirecting from as a RewriteCond, but to redirect all domains, you would simply use the following:
Thanks Scott…I really appreciate your help… I am also facing problems in making URLs seo friendly by trailing slash and removing extensions from URLs by trailing slash.. The code i am using in my .htaccess is
Options +FollowSymLinks
Options -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/.]+)/$ $1.php
RewriteRule ^([^/.]+)/([^/.]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
Then it only make urls SEO friendly. Error 404 occurs on extension removal.
Please help me out of this, Thanks in advance….
Thanks for the question. We unfortunately can’t write the code for you, but we do try provide solutions for articles that we provide for issue like redirects in .htaccess. In your case, if you are using a software like a ecommerce software then you may want to consider possible extensions or modules that you can add to resolve this type of problem. If you want to figure out the code, please consider this post which discusses the removal of extensions and the forcing of www and trailing slashes.
Example:1 not working….i Want to redirect my domain ludhianaweddingvendors.com to ludhianaweds.comkeeping rest of the URL same also changing with the new URL in address bar. But m failed….Any help ?? Thanks in advnace…
I tried the code you referenced on my server and it worked fine. This code is intended to allow a domain name different from the primary to display the content of the primary under the second name. For example, if your primary domain name is ‘example.com’ and you want to allow ‘examole.net’ to be used and show that same data, you would set it up like this:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.net
RewriteRule ^(.*) https://example.com/$1 [P]
Setting it in reverse order causes a proxy error on the server.
I have a domainA.com and changed my url to domainB.com. As i had maintained urls friendly, i want visitors on going to domainA.com/page1 to be redirected to domainB.com/page1, as the content and url are the same, just changed by domain.
For the moment i am using DirectAdmin, but acting as my own reseller i think i own full access to www.frituurrombout.be
The goal is to show the content of www.romboutmechelen.be but the URL bar should simply state : https://www.frituurrombout.be
For the moment there is nothing configured in www.frituurrombout.be, but in future i might want to install a WordPress site, so that i can show more pages than just the content of www.romboutmechelen.be
I like your idea of the second option in the article. But don’t know what to put in “path to get there [p]”
Can you type it out for me ?
Many thanks in advance.
Here’s my take :
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.frituurrombout.be
RewriteRule ^(.*) https://www.romboutmechelen.be/index.html [P]
The path you’re referring to has to do with the webpage that you’re trying to point to. So, if the page is in a certain folder, then path would look like this: https://www.domainname.com/folder/filename.php. I hope that helps explain the issue.
Thank you for your question. By “plain redirect,” I think you mean creating a redirect in your cPanel. This just creates a redirect such as:
example1.com —-> example2.com
To show contents from DomainB but show DomainA url there are 2 options:
Get web hosting that grows with your business. Our all-in-one hosting platform gives you everything your website needs to scale - so you can focus on the next big thing for you and your business.
Happy to help!
All,
I’m trying to figure out the feature or the term used in a proxy. e.g. I enter www.somedomain.com/test but the proxy redirects it to www.somedomain.com. What happens behind the scenes, in this case
I think you’re talking about an alias or redirect . It’s basically redirecting or rewriting the URL to another location. You can set up a redirect in an InMotion account using the cPanel. There are a few types of redirects – permanent and temporary. Search engines often place importance on redirects, so it’s important that you use them correctly. You can use this article for more information on creating permanent redirects.
————————————
This is the Correct way to masking your domain another domain.
Thanks for providing your solution. Your contribution to the community is appreciated!
Hi I have a WordPress theme for which multiple installation is allowed only on subdomains. I have this theme installed for several subdomains and I want to access these subdomains using unique domains name for each of them however I want to keep the subdomain URL masked. Kindly suggest which method should I use avoid infringing upon the only subdomain installation requirement of the theme. Thankyou
Thanks for asking about masking your subdomain URL. InMotion Hosting does not support domain masking with its hosting service. Also, if you’re limited to use subdomains for a theme, then you should not be using unique domain names to access the site since the theme is limited to a specific domain. You will need to check with the theme provider for further support with this issue.
If that code is not yours, then you should remove it. Additionally, please make sure to check your .htaccess file. You can see more information about cleaning up an .htaccess hack in this article. We cannot change your website code for you through the Support Center. If you require further coding assistance, then you should consult with an experienced web developer.
My website www.klecbahubli.org has been redicted to one of the spammy website(www.mersinhabercs.com), I am unable to find the code also to remove, Kindly help me to resolve the same.
When I am checking my website in google webmaster, I am finding the below code in header section of my website.
<script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js”></script>
<script type=”tect/javascript”>
window.location.replace(“https://www.mersinhabercs.com”)
</script>
Hi Team,
We need to redirect the URL from www.basics.com/cyber to www.life.com/cyber.But the URL dont change to www.life.com/cyber and it will show the content for www.life.com/cyber.I mean URL masking.We have tried below code but it is not working
# BEGIN WordPress
<IfModule mod_rewrite.c>
Options +FollowSymLinks +Indexes -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteRule ^cyber/?$ https://www.life.com/cyber/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Please help me
You can use a 301 redirect, but replacing an existing domain name with another domain name to mask the origination of the link is not something we typically allow in our hosting service. If you are not hosting with our service, then you may need to consult with your host’s service to understand how this may be done.
Can you please help me? I have a wordpress site, https://mydomain.com and created almost all of my redirects on cPanel via subfolders, https://mydomain.com/dir and so on. They’re all been working fine until a week ago when all of my redirects point to a 404 page. I tried undoing my domain’s htaccess file, having it on its default code and it kinda worked at first. But when I refreshed my browser, it then again redirected to a 404 page. What could be the issue here? I hope you guys can help me. Thanks.
I do not recommend adding codes directly to your .htaccess file since it can interfere with your website. This is because WordPress also relies on .htaccess rules. Instead, try using a clean WordPress .htaccess file and use a plugin to 301 redirect the broken links (there are many plugins available such as redirection).
Thank you,
John-Paul
I believe this message is indicating that content has been identified on the domain, that does not comply with the standards and regulations set forth by the Department of Telecommunications . Typically this is due to the presence of copy-written media. A redirect may resolve this issue, however, the government may restrict access to the new domain it is redirected to, if the same content is detected.
Instead of circumventing the government’s regulations, I suggest you remove the content or contact the Department of Telecommunications to discuss the matter and proper steps to become compliant. They may also be able to provide further insight into why the domain is being blocked. I hope this helps!
Sincerely,
Carlos D
my website is configured wrong the below is serving every page, complete novice, looking for some help to solve.
<link rel=”canonical” href=”https://www.zebraonegallery.com/artist/dan-pearce/”>
Hello,
Thanks for the question in regards to the canonical URL. Canonical URLs are used to tell search engines about URLs that are identical. This often happens with product URLs where different products are accessible under the same URL. If you want a decent tutorial on it, please see rel=canonical – the ultimate guide.
If you have any further questions or comments, please let us know.
Regards,
Arnel C.
301 redirect htaccess, if input url is does not exit’s in web then controle is automatic move into web home-page (index.jsp) url.
Hello Gaurav,
We’re not sure what you are asking. Can you please explain the problem? If you can also provide the code, then we can look into the issue in more depth.
Regards,
Arnel C.
Hi,
I have configured my domain name in Amazon Route 53 and the domain is redirecting correctly to the EC2 instance where my site is hosted. But the URL changes to the one in the EC2 instance.
so, when I hit – www.example.com, it goes to my Ec2, but url changes to https://ec2-instance-exmaple.com
how can we do to keep my domain name(www.example.com) visible in the URL?
Thank you,
I’d suggest reaching out to Amazon for support. Unfortunately, we don’t have the expertise with Amazon EC2 and S3.
Thank you, John,
I have read this article before. and I found, will have to redirect everypage manually. That is the really problem. but its ok
Thank you
Vijay, this will depend on your .htaccess file, but the exact instructions you should need are to redirect any page from your old domain to your new one. This will redirect any URL to the new site.
Hi, I am glad, you wrote a very usefull information here. I have one question.
My Old website *****.in and I redirected this site to new url https://*****.com/blog . When I open old site I redirected to new webaddress, but other pages are still opening in old url.
For example: https://*****.in/how-to-update-and-upgrade-kali-linux-to-latest-version/
What should I do to redirect each and every page to my new site.
Here is a link to our helpful guide on how to Redirect an old domain to a new domain. It should help you resolve your issue.
Thank you,
John-Paul
am able to url forward to other ip based application. but i cant restrict the application to open by ip address apart from domain name. how can i restrict users to open ip based url
Srinivas, making an IP address load a webpage directly is a server-level change. Please also keep in mind that loading a website from an IP is generally a bad idea. You would need to talk to your server administrator for enabling such a feature.
Hi i am redirecting my pages that are not found to error404.php. For example my URL is www.example.com/Products and User type www.example.com/Product
Then the page will be redirected to error404.php and URL becomes www.example.com/error404. Its annoying for user to write the same URL again and correct error. I want to redirect my page to error404.php but i want to keep URL same the user typed whether it is right or wrong…Thanks
What is your website built with? Also, you should be careful not changing the URL for SEO purposes. Technically, to Google this could be problematic.
Hi Tim
Thanks for your reply.
I use DomainB to host sites that are being developed. For example www.DomainB.com/dir/dir/. I was trying to use a simple subdomain such as demo.DomainB.com to point to the area. SEO is not really an issue.
Once the project is complete, it will be moved to its new host.
Hope that makes sense.
Ian, if SEO is not an issue for this domain then you should be fine with the current solution.
Rick, it sounds like you just need to add the domain rapromos.net to your Apache configuration so that it points to the same folder that redfoxrap.com/rapromos.Is points to. If you have cPanel, this is a very simple process that you can do when you add the new domain by changing the value for the document root.
Ok I have been trying to get this working and I am confused. Been trying to find a solution in the comments but not finding what I need so decided to ask a question. My client has his domain in one registrar, but I made him a site on my registrar because he wanted the cheap deal from mine. We are trying to get it where instead of the host domain urls to be used… using the domain from his registrar.
For instance, domain he wants is https://rapromos.net… but the site is hosted under https://redfoxrap.com/rapromos.
Is there any way to make it so the links on the wordpress site here reflect the domain he wants? I tried the .htaccess methods with no luck. I currently have forwarding in place for rapromos.net to point to the site and mask it. However all of the links on the site still show redfoxrap.com/rapromos. Is there a way to mask this?
Does adding redirection codes in htaccess file affetc hot link protections.
Hello Deb,
It’s possible that they can conflict. Directives in .htaccess are read from the top down. So, just make sure that you put what you want to happen first at the top.
If you have any further questions, please let us know.
Kindest regards,
Arnel C.
Hi
I have read through this and there seems to be conflicting answers and am a little confused. Your article suggests that this is possible:
subdomain.DomainA.com redirects to DomainB.com/folder/
and the browser would show subDomain.DomainA.com/
Is that correct? No domains are parked.
Thanks for any enlightenment.
Yes, in theory, what you are asking is the first option. However, its not very wise to do so. Google will see the content on the domain as duplicate and penalize you or worse, remove the sites from their search results altogether. The bigger question is, what are you trying to accomplish by having two different domains share the same content? Maybe there’s another, more appropriate, solution.
I have 2 websites, MyCreditLead.com has all of our content… but we wanted a domain name that matches our business name = CreditGuardUSA.com.
So, we want our site visitors to go to CreditGuardUSA.com but land on MyCreditLead.com…. which I have already setup as a 301 redirect. But my site visitors are seeing it change to https://mycreditlead.com, when we need them to see https://CreditGuardUSA.com in the URL.
How do I fix this? Please remember I do not have any content on the CreditGuardUSA site.
And will Google be okay with us showing CreditGuardUSA.com in the address bar, yet displaying content for MyCreditLead.com?
With cPanel, a domain that is set up as ‘parked’ to the main domain will keep the domain name typed in the browser window. Example: setting CreditguardUSA.com as a parked domain to MyCreditLead.com should keep CreditguardUSA.com in the browser. This only works with the primary domain name and will not work with any addon domains. The others will simply switch the names in the browser. This may or may not change with different cPanel versions.
What you are asking is called ‘masking’ and, other than the behavior in cPanel, we do not do. Since you gave the domain a 301 redirect, Google will be fine with it as a 301 says you mean to have the redirect set up permanently.
Dear all,
I want to redirect my URL to hide my URI.
https://example.com/abc/logic.jsp to
https://example.com
Please help me with this concern.
Thanks in advance.
Regards,
Mohammad Ghouse
It looks like there is no easy way to redirect 8080 over proxy and to disable HTTP, as almost everything we put after this – like its ignored or create 500 error.
RewriteRule ^(.*) https://localhost:8080/$1 [P]
We can’t edit httpd.conf on managed so looks like we need to edit all that over htaccess, to redirect GlassFish to be over HTTPS and to use Proxy with .htaccess
Alex, I would try using something like:
RewriteCond %{HTTP_HOST} ^sub.website.com:80$ [NC]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://localhost:8080/$1 [L,R=302]
Hello,
May I know the way to solve this case? Redirect main domain to the subfolder without changing the URL.
SAMPLE 1
Redirect page:
https://www.domainA/ => https://www.domainA/subdirectory/
Browser URL:
https://www.domainA/
SAMPLE 2
Redirect page:
https://www.domainA/abc => https://www.domainA/subdirectory/abc
Browser URL:
https://www.domainA/abc
You should be able to accomplish this with “Example 2” above.
Thank you,
John-Paul
hello Arnel,
Can you help me with a htaccess code for below situation:
I have domain.com stored on the host server in a subfolder. If I type in browser domain.com/subfolder I can access my site but I want to type just domain.com and after redirection will made, I want to still see on browser domain.com not domain.com/subfolder
Can be possible?
Hello Viriones,
You do not need an .htaccess code for this situation if you are designating a specific domain name (not the primary domain created for the account) for the subfolder. You can use an Add-on domain. Add-on domains are saved in separate folders in the account (typically subfolders), but still recognized as individual websites based on a specific domain name. So, if you have public_html/exampledomain where the Exampledomain folder is also the root folder for exampledomain.com, then you can set up the addon domain and it will be seen by viewers as a separate website.
I hope this helps to answer your question, please let us know if you require any further assistance.
Regards,
Arnel C.
It’s an expired domain and has links from twitter/fb, many other sources. Now when someone clocks a link on let’s say twitter – like this – fun140.com/quizz-online-game-7997/ it leads them to bestuscasinos.org/quizz-online-game-7997/ ….and there are hundreds of such urls on old site that are linked so I don’t know what to do..
Please let me know if it’s possible to 301 all those inner(and deleted) urls to the homepage of fun140.com somehow and then 301 fun140.com to bestuscasinos.org so that I dont get 404 errors ..
Thanks.
Hello AK,
The re-write rule can be used for a 301 redirect. For more information on using a re-write rule, check out this Setting up a permanent 301 redirect via .htaccess. You will need to setup a rule to replace the the old URL with the new one in your .htaccess file.
If you have any further questions or comments, please let us know.
Regards,
Arnel C.
We answered your question here: https://www.inmotionhosting.com/support/questions/domain-names/showing-map-on-my-site
If you have further questions you can comment on that thread.
Please find below the htaccess I’m using. The homepage of old site redirects alright to the new site but the old urls(indexed/linked from other sites) do not point to the homepage of new site.
RewriteEngine on
RewriteCond %{http_host} ^www.*****.com [NC,OR]
RewriteCond %{http_host} ^*****.com [NC]
RewriteRule ^(.*)$ https://www.********.org/ [R=301,NC,L]
A possible solution is to 301 redirect each individual page in the .htaccess for the old domain, to the new urls.
Thank you,
John-Paul
Hi John,
I want to 301 redirect all the inner pages of a website to the homepage of other website. Could you please let me know the htaccess code for this? Right now the old(and removed) urls from old site are casuing tons of 404 errors on new site, because oldsite.com/gamepage/ is returning error on newsite.com/gamepage/ ….. it’s not possible for me to put all the exact urls on new site thats why the problem.
Thanks.
If you do a 301 redirect at the top level domain it should redirect to the new site before attempting to load the inner pages.
i didnt find the .htaccess file in my hosting.
what should i do i need to write this command
RewriteCond %{HTTP_HOST} ^domainx.com
RewriteRule ^(.*) https://domainx1.net/$1 [P]
You can create a new file within the File Manager. Just click “Create File” and name it .htaccess (don’t forget the . at the front!)
Well concerning example 3, I want to redirect specific IPs on Domain, “A”, and if User IPS do not match with assigned IP’s, the user should be redirected to Domain B. Can you help regarding this in context of coding. Actually i want to add “Not” condition in RewriteCond %{HTTP_HOST} ^##\.##\.##\.##
We are happy to help guide you, but unfortunately cannot provide custom coding solutions.
Thank you,
John-Paul
Doesn’t this in effect create two twin sites which would split my Google hits and traffic between the two? I just want one site that people are directed to from either URL.
For SEO purposes, yes, you will want to use a 301 redirect.
I just signed up for hosting with Inmotion. I purchased two domain names: “example.com” as my main domain as well as “theexample.com” just in case anybody assumes the “the”. How do I arrange it so that “theexample.com” sends people to “example.com” without having duplicate websites?
Try the code in Example 1. That should get you the desired effect.
Example 2 above should allow you to accomplish this. Be sure to replace “DomainA.com” with the “siteA.com/award” URL.
If it is not working, review your other .htaccess rules as one may be interfering.
Thank you,
John-Paul
Hello. I love your post but I am having some issues.
What I need is to keep the website and just redirect a specific subpage.
Ex: siteA.com/award -> siteB.com
I tried to change your code accordingly but, I might be doing something wrong.
Can you help me?
thanks
Well, my hosting company told me that I could not redirect from a shared hosting environment, which is why I wrote what I wrote. Sorry about that. When I did write a redirect it shut my site down and threw up a 500 internal error code. I did the comment line then
Redirect /Folder/File.php https://mydomain.com/Folder/File.php
(inserting the various variables where needed but the format was as above)
I did not have a rewriteengine rule written anywhere.
One thing none of you have ever mentioned which tends to make it really annoying for those on shared hosting packages is that these solutions with .htaccess files do not work for domains that are on shared hosting environments. I have spent a good few hours today trying to redirect a specific file in a specific directory to another specific file on another domain I own which is hosted elswhere. I have my reasons for doing this which I will not get into here, suffice to say I wouldn’t try doing this if I didn’t absolutely need to. So, don’t go assuming that everyone is on a dedicated server. But maybe the above post was written for this specific company (inmotionhsoting.com) where people do not have shared hosting. If that is the case please make that obvious.
Hello cas,
The .htaccess file was created to allow configuration changes on a cPanel account level, for those who do not have access to higher server functions. The .htaccess file is perfectly suited for shared. It is most definitely not only for use on a dedicated server.
Most of our customers are on shared servers and use .htaccess functions to do things such as redirects or rewrites.
Kindest Regards,
Scott M
How can i block ads from another site that i have on iframe?
Hello Frank,
I think that using the rewrite rule (as described in this article) in your .htaccess file might be the best way.
If you have any further questions, please let us know.
Kindest regards,
Arnel C.
i want to redirect from site name eg https://test.com/ to https://www.test.com/ through php not through htaccess .
any one plz help me urgently
Hello Muhammad Sareer ihsan,
Our redirect articles are all based on .htaccess re-directs, so you would need to reference outside posts for this information. Check out this post as an example. If you have any further questions or comments, please let us know.
Regards,
Arnel C.
Hi All,
Is there a way to redirect site.com/blog to my external site blog.site.com but will retain the site.com/blog in the browser?
Thanks,
Hello Earl,
It looks like you’re trying to re-direct someone to a different location but showing the same domain name as before. That is called masking and we don’t have any tutorials for that, unfortunately. You may be able to find ways to do it by performing a search on the issue in your favorite search engine.
If you have any further questions or comments, please let us know.
Regards,
Arnel C.
Very interesting post! My question is: Where is the htaccess file (to be) located? Background: I have some drupal test sites in /var/www/html/folder1 /var/www/html/folder2, … on an Amazon EC2 instance (linux)
For me example 2 would fit, I think. I want to redirect from mydomain.com to amazon-ip/folder2
There is an htaccess-file in each of these folders but I think these are not the files to be modified, right? Is there some kind of top-level htaccess file?
Thanks, guys!
Hello Diceres,
As your system is setup differently than ours, I wouls suggest running the commands below as a root user to find your .htacces files.
cd /
find . -name “.htaccess”
Best Regards,
TJ Edens
Hi,
I’m operating as a distributor for a company, and they have provided me with a subdomain and a website template which is hosted on their main website.
I’m concerned about my SEO ranking by using a subdomain and want to use my own personal domain; however, I’d still like to retain the company’s template.
Can I redirect to their subdomain?
And would the SEO still perform poorly as it’s redirected to the subdomain?
Thanks
Hello RPM,
If you use a 301 redirect, Google should not penalize any redirects.
Kindest Regards,
Scott M
not working for me
RewriteEngine On
RewriteCond %{HTTP_HOST} ^msrawysat.com/$1
RewriteRule ^(.*) https://www.masrawysat.com/$1 [P]
when i preffer to msrawysat.com it is not redirect to masrawysat.com
thanks for advice
Hello Alaa,
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ https://example.net/$1 [L,R=301,NC]
That would probably me more appropriate. You can see the re-direct rule in this article: Setting up 301 redirects.
I hope this helps to answer your question, please let us know if you require any further assistance.
Regards,
Arnel C.
How to redirect from https://domain.com/administrator to https://domain.com/admin
You may want to check out our individual examples at our 301 redirect article.
Hi,
My problem is:
I have a DOMAIN NAME A point to another server with https://domainB/subfolder, my .htaccess redirect is ok but in the browser after that display “https://www.domainB/subfolder”
I need to keep ONLY DOMAIN NAME A in my browser even the real content is pointing to hostingB, i was trying 3 days searching google and testing and i can´t.
Can you help me?
Hello Cucuyito,
Thank you for posting your question about redirects. I’m happy to assist you. Unfortunately, what you are trying to do is not possible. Once the htaccess redirect send the visitor to the other site, they are on that server and you have no control over it. Any further actions would have to be handled on the other site. However, if both sites were on the same server, you could set up a parked domain.
I hope this helps! Let us know if you have any further questions.
Thanks!
Tim S.
please help in keeping the url https://example.com/example1/welcome and displaying the content of
https://example.com/example1/hello.html and i wanna keep the .htaccess file in the example1 folder
Thanks
Hello Herculus,
Thank you for contacting us. You should be able to accomplish this using the Proxy flag in mod_rewrite, here is a link to some detailed information on Using mod_rewrite for Proxying.
You will have to custom-code/develop a working solution. If you need assistance, I recommend consulting a developer.
Thank you,
John-Paul
Hi John,
Same here.
Code doesn’t work. I only got plain HTML page inside cpanel files. No CMS or anything.
Here’s my code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.theblessedtree.com/$1
RewriteRule ^(.*) https://cpd.ispringlearn.com/$1 [P]
Thanks for your help mate.
rgrds,
ian
Hello kms,
This method will not mask the URL. When the redirect happens it will display the final URL. As we do not allow masking on our servers, we do not have any code available that does that.
Kindest Regards,
Scott M
Hi, If I have a domain something like “abc.com” and I started my work on a subdomain “site.abc.com” now I want to mask the site.abc.com to show abc.com…?
I posted a question and got an email that says I got a reply from Scott yesterday. Today I come to find it and answer his questions and both question and answer are gone? I’m confused.
Hello Doug,
Apologies, the question was not yet approved so it did not display unless you were logged in. It should show now.
Kindest Regards,
Scott M
Lots of comments and lots of different solutions…so much that I’m a bit lost. Plus there’s a twist to my situation with email.
I have domainA.com which is built on OpenCart and actually my primary domain. I wanted to switch to WordPress and built domainB.com on WP. Same products, different platforms and totally different url setup.
I tried simply forwarding the domain but as we know, it changes url and email stops working.
What is the best way to forward domainA to domainB without losing email and keeping the domainA.com in the url? I know it has something to do with changing mx record in the domain registar(GoDaddy) but not sure what. Also, which method above is going to not hurt my seo?
Thank you for the assistance, it is much appreciated.
D
Hello Doug,
I’m a bit lost on what you are trying to accomplish. I understand the DomainA to DomainB redirect. That can be accomplished via the cPanel. After the redirect, you will not have DomainA in the URL, that is the point of a redirect. These redirects do not affect the way emails work or are delivered.
If you are referring to how to log into the webmail section (domainA.com/webmail switching to domainB.com/webmail) then that is only a visual change in the address bad and will not affect the emails.
The URL portion of the webmail is not important as long as it points to the right server and you can simply use the Temp URL webmail login URL if you like. You can find that URL within your AMP settings.
Kindest Regards,
Scott M
Hi, I’ve got som problems getting this to work.
I am using an advertisement service that shows my content as https://domain.com/folder/shortcode (like https://domain.com/folder/abc12)
My intention is to setup a subdomain https://sub.mydomain.com and redirect every advertisement shortcode from my sub domain to the actual page, like this:
sub.mydomain.com/shortcode >> domain.com/folder/$1
I tried URL forwarding from cPanel, and this works fine, but it does not mask the URL. CPanel creates this .htaccess file :
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub\.mydomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.sub\.mydomain\.com$
RewriteRule ^/?$ “http\:\/\/domain\.com\/folder\/\$1” [R=301,L]
I tried your setup and replaced the content of the .htaccess file with this: (Please note the missing $, I removed it since you don’t use it in your examples. Doesn’t work with or witout it)
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub\.mydomain\.com [OR]
RewriteCond %{HTTP_HOST} ^www\.sub\.mydomain\.com
RewriteRule ^/?$ “http\:\/\/domain\.com\/folder\/\$1” [P]
Regardsless of what I try a 404 pops up : (from https://sub.mydomain.com/3e4UJ)
Not Found
The requested URL /3e4UJ was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Any suggestion on what is missing here? Many thanks in advance for your help.
Hello Harry,
Thank you for contacting us. We spent some time looking into this, and could not find a way to make your rules work.
The only way I know to mask a domain is by adding it as a Parked domain.
Thank you,
John-Paul
I am trying to do example 2 but I can’t get it to work right.
I want to move visitors of sub.Domain1.com to https://domain2/folder/script.php, all while showing sub.Domain1.com on the url, and keeping SSL padlock in place *(Domain2.com has an SSL certificate, and Domain1 has flex SSL with cloudflare).
I know this is possible, because I have seen it done before with my setup above. I am just trying to figure out how. I would greatly appreciate any help. Thank you!
Hello David,
Suggestion #2 may not be what you are looking for because that method will change the url completely and not display sub.domain1.com. Please also make sure that the following is inside your .htaccess above your re-writes.
RewriteEngine On
Best Regards,
TJ Edens
Hello eyerybody.
I would like to redirect DomainA/folder1 to DomainB/folder1. I placed the .htaccess with the code under folder of my web-address (DomainA). I tried both methods of redirecting, but I’m getting a 403 Forbidden error. I checked both the DomainA/folder1 and the DomainB/folder1 permissions and they are both readable and executable for everyone (rwxr-xr-x). The .htaccess file itself has 644 permissions (but I tried also with 777 and it didn’t work). What else could I look at?
Thank you.
Hello,
It sounds like everything should work though I cannot see the specifics of your account. If you are one of our customers and still have issues, you may want to contact Live Support so they can further assist with any individual problems.
Kindest Regards,
Scott M
Hi John-Paul. Thank you very much for your reply. Now the following part of my question would be:
If I have Domain1 with an official SSL certificate and Domain2 (on another machine) with a self signed SSL certificate, and I set up an .htaccess file the way explained here, will a browser calling Domain1 via https receive a message saying that the server can’t be trusted, as it normally happens by directly calling a server that has a self-signed SSL certificate?
Basically what I’m trying to do is the following: I have Domain1 hosted by an external company, where the web site is hosted, and I can’t install software on that machine. I have a dynamic dns Domain2 to my own computer where I can install all the software I want. I would like my customers to call Domain1/directory1 and receive the response from my computer (Domain2/directory2) where the software actually runs. However I would like to install the SSL certificate to secure the connection only on one computer, if that’s possible.
Is there a way to do this?
Thank you very much.
Andrea.
Hello Andreacroci,
SSL certificates are dedicated to a particular URL set (www and the non-www version of the URL). If you’re going to be re-directing to another computer with a different URL, then the URL without the certificate would not be secured by the SSL certificate. The computer you’re not able to install will have a secure connection as long as you’re getting to that computer with the URL specified within the SSL certificate.
Regards,
Arnel C.
Hello,
I have an online software. When I type in the url, https://abc.co.ae and a login page for the software https://abc.co.ae/login.aspx.
But when I type only the https://abc.co.ae, the result shows page cannot be found.
But I want to redirect to the login page when I enter the above link…
Regards,
Sajin
Hello Sajin,
You may try using a variation of scenario 2 above. However since you are using aspx files, you may be on a Windows server. We are not able to advise on IIS or how it is particularly set up as we have no Windows servers.
Kindest Regards,
Scott M
Hello, first of all let me compliment you for the very helpful tutorial and answers. I have a question that I didn’t see here.
Let’s say I have Domain1.com and I want to redirect it to Domain2.com. If Domain1.com has an SSL Certificate and is addressed via HTTPS, will the connection to Domain2.com be encrypted even if Domain2.com doesn’t directly have a certificate?
Also, I’m assuming in the rules it would have to be specified that the redirected domain is an HTTPS and the target domain is a normal HTTP, right?
Thank you for your help.
Hello Andreacroci,
Thank you for contacting us. No, only the exact domain listed in the SSL certificate will be secured.
Yes, you will need to specify whether you want to redirect to the “HTTPS” or “HTTP” domain.
If you have any further questions, feel free to post them below.
Thank you,
John-Paul
I want to rename my url address
https://newmobileinfo.com/detail.php?id=X325
to
https://newmobileinfo.com/Ophone/X325
using .htaccss.
Can any one help me to change this url?
Hello Sattar,
Check out this tutorial for .htaccess query string rewrites . It should give you the rewrite you need.
I hope this helps to answer your question, please let us know if you require any further assistance.
Regards,
Arnel C.
Will it take a long time? If it can be done easily can you help me with this Mr.Scott? I can give you access to my site.
Hello Vicky,
Unfortunately we do not provide custom code solutions. If you are unable to code it you may want to hire a developer for this task.
Kindest Regards,
Scott M
Helping me with this redirect would be of great help. Its been long time since I am trying to find a solution.
My wordpress site fashiontiptop.com. It is a amazon affiliate site.
When I click buy now button on each post (for example: https://www.fashiontiptop.com/volcom-mens-frickin-modern-stretch-short ) it should go to this page ( https://www.fashiontiptop.com/thanks/ ) and after 1 second it should redirect to the respective amazon product page.
I am not a techie… please assist…
Hello Vicky,
This is not something that can be accomplished with a small change to an htaccess file. The thank you page would need to capture the original URL that the visitor came from and then redirect to the proper Amazon page. This can certainly be done with proper coding, however.
Kindest Regards,
Scott M
The following works for me:
Hello Suresh,
I am not aware of a possible way to accomplish this with an .htaccess redirect. The only way I know to do this is if domainB.com is your Primary domain, and you Park domainA.com in your cPanel.
Thank you,
John-Paul
Hello,
I have a domain domainA.com which will redirect to domainB.com without any issues. But when the redirection happens i dont want the users to see domainB.com in the browser, i still want it domainA.com. Here is the code i have.
RewriteEngine on
RewriteCond %{HTTP_HOST} domainA\.com [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ https://domainB.com [L,R=301]
Thanks in advance.
Hello Suresh,
The destination domain will always display in the URL bar.
Kindest Regards,
Scott M
Hi- I’m having trouble with these solutions listed – so I want to make sure I’m doing everything correctly. Here is my scenario:
I have a landing page at www.domainA.com/landingpage.
I have a domain at www.domainB.com
When I have a visitor go to www.domainB.com, I want them to see the content on domainA.com/landingpage, but see www.domainB.com in their address bar/url bar.
Is that something that can be done with one of these solutions?
Hello Pete,
Using the second option above should meet your needs. You’re basically re-directing to domainA.com/landpage (a specific URL) without changing the URL in the address bar.
I hope this helps to answer your question, please let us know if you require any further assistance.
Regards,
Arnel C.
Please see the following scenario:
I would like to redirect domainA.com.sg to domainB.com/subdirectory. I don’t want to change the URL to “domainB.com/subdirectory” when I access domainA.com.sg.
I am using the following in .htaccess:
++
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domainA.com.sg
RewriteRule ^(.*) https://domainB.com/subdirector [P]
++
Regards,
Hari
Hello harikrishnan,
Apologies if the title of the article was misleading. The URL in the web browser will display the destination URL once it redirects.
Kindest Regards,
Scott M
No its not working.
Hello Akif,
Sorry for the continued issues with the re-writes. You may want to check out the code provided in this forum: Dynamic subddomain with htaccess. The answer provides code that you can modify for your purposes.
If you have any further questions or comments, please let us know.
Regards,
Arnel C.
Hello,
I want my sub domain to read contents of a specific page. This is my current .htaccess code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*)\.citywideapp\.com
RewriteRule ^(.*)$ https://citywideapp.com/subpage.php?rep=$1 [NC]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
</IfModule>
What I exactly want is for a sub domain murray.citywideapp.com, it should read contents of citywideapp.com/subpage.php?rep=murray
Any help would be appreciated.
Thanks,
Akif
Hello,
I believe I see what you are trying to do. Try this below and see if it yields better results.
RewriteCond %{HTTP_HOST} ^([^/.]+)\.citywideapp\.com$
RewriteCond %1 !^(murray|john|helen)$ [NC]
RewriteRule (.+)$ “https://citywideapp.com/subpage.php?rep=%1” [L,P]
Just put as many names as you need in the middle.
Best Regards,
TJ Edens
Hello There,
I am currently doing mainternace for my website and created ‘Mainternance theme folder’ for visitors.
My Question is – How can i redirect all IP to Maintenance Theme Folder Index.html except my IP.
My Current code is:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/Maintenance Theme Folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /Maintenance Theme Folder/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ Maintenance Theme Folder/maintenance.html [L]
_____________
Currently, any one can successfully visit maintenance theme and can be aware that the site is under maintenance.
However, i want to work back end and need to see the actual progress of my site.
My current Index.html path is www.example.com/index.html
Can you please help me?
It would be highly appreciated.
Thanks
Hello Nick,
Something as in the code below should work for you.
RewriteEngine on
RewriteCond %{REMOTE_HOST} !^127\.0\.0\.1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/Maintenance Theme Folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /Maintenance Theme Folder/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ Maintenance Theme Folder/maintenance.html [L]
Best Regards,
TJ Edens
I think I have an issue. I want to Redirect site1.com to site2.com but in the address bar I want to see “site1.com/www/index.html” Showing.
Index.html hawever is actually located at site2.com/www/
Hello Eileen,
Thanks for the question. The point of this article is changing the URL using a rewrite in the .htaccess so that you can use a different URL from the original. The original URL is re-written, to the new URL you want to use and then any subsequent path will go to that URL. If you were to change the path for your website, the subdirectories for the website should exist at that domain. Otherwise, you will get a 404 (page not found error). You would need to make sure that the files for your website are in the path that you are changing it to. For example, the default root folder for InMotion Hosting’s websites is public_html. If the primary domain is retailB.com, then files would not be located in that location because the website was built elsewhere (under the location for retailB.com). You would need to copy the files to the public_html (for retailA.com) and then use a re-write rule (as per above), so that anytime types the URL, then they would be getting to a web page that exists at that location. I hope that makes sense for you.
If you have any further questions or comments, please let us know.
Regards,
Arnel C.
Hello Sello,
Thank you for your question. To accomplish this, your document root for site1.com should be site2.com/www/.
Then, you would need some .htaccess rules like this:
RedirectMatch 301 /(.*) /www/$1
If you have any further questions, feel free to post them below.
Thank you,
John-Paul
My domain for example is retailA.com. I commissioned a provider to create me a new page and they assigned a different domain retailB.com. The new page/domain has subsequent/inner pages.
Now, i want for my homepage (retailA.com) to look like retailB.com withouth having to change my url to retailB.com. My question is, how will any of the solutions (especially solution 1 and 2) affect the inner pages of retailB.com?
Thanks,
Eileen
I have several domains parked with inmotion hosting. I want to forward these to my hosted domain of sacredpostures.com. I don’t see an option to do this for parked domains without cpanel logins. Can you help?
Hello Thomas Walker,
Thanks for the comment. If your domains are already set to InMotion’s name servers, then you can use the cPanel Domain Re-directs.
I hope this helps to answer your question, please let us know if you require any further assistance.
Regards,
Arnel C.
Hello and Happy new year.
My case is my main domain is domain.gr ( Greek language)
I have also domain.net witch i want to redirect to domain.gr/en witch is the english version of domain.gr.
i add to htaccess of domain.net
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{HTTP_HOST} !^domain.net$ [NC]
RewriteRule ^(.*)$ https://www.domain.gr/en/$1 [R=301,QSA,L]
</IfModule>
Redirect works correct but i want to mask the adress of domain.gr/en and shows domain.net/
Can you help?
Hello Alex,
In order to mask a domain you would need to park your domain.com, however the redirect may not work if you do so.
Kindest Regards,
TJ Edens
Hi InMotion,
This is a surprisingly confusing writeup. It could be much clearer.
Ex 1: “keep everything after the URL”.
There is nothing after the URL. Not in that example, or in any example. The whole thing is the URL. I assume he means to say the domain name or the TLD.
Ex 2: “redirect to show a specific URL, but keep the domain the same as well”
The example proceeds to show two different domains – DomainA and DomainB. The above text stating that this example was to “keep the domain the same” is very confusing. This example has nothing to do with keeping the domains the same, and they are not the same.
It goes on to give a use case where “you had an external blog such as one on blogspot.com”. This is the past tense – you had an external blog. But reading it through suggests he means a blog that you have right now, which is the opposite. It’s just so confusing. This could be so much clearer for people.
Hello Joe,
Thank you for pointing these issues out, I will see to have them addressed. However just so everyone is clear that comes across this in the future. This article is giving an example of you having myblog.blogspot.com and you want myblog.com to point to myblog.blogspot.com.
Kindest Regards,
TJ Edens
Hello Andre,
You may want to try setting the 301 redirect to a new file extension. This is discussed in our article on 301 redirects>.
Kindest Regards,
Scott M
Thank you so much for the post. Been looking for such a solution for a while since.
However, I did this:
RewriteCond %{HTTP_HOST} ^test.domain1.com
RewriteRule ^(.*) https://test.primary1.com/$1 [P]
And it redirected without the URL changing.
But https://test.primary1.com has a login page, the moment I login, the url changes from test.domain1.com to https://test.primary1.com
Is there any more conditions that I ought to put to make it remain?
Thanks.
Hello Dapo,
It is difficult to say right off hand. If you are using a CMS of some sort, they tend to have their own redirects and rewrites also involved. The .htaccess file is read from the top down, so there could be other rules involved as well.
Kindest Regards,
Scott M
Upon bouncing I’m getting this error for mail delivery failure
This email is being returned to you because the remote server would not
or could not accept the message. The registeredsite servers are just
reporting to you what happened and are not the source of the problem.
The address which was undeliverable is in the section labeled:
“—– The following addresses had permanent fatal errors —–“.
The reason your mail is being returned to you is in the section labeled:
“—– Transcript of Session Follows —–“.
554 5.0.0 MX list for mail.ipixio.in points back to atl4mhib61.myregisteredsite.com
554 5.3.5 Local configuration error
Final-Recipient: RFC822; abc@ipixio.in
Action: failed
Status: 5.5.0
Remote-MTA: DNS; mail.ipixio.in
Last-Attempt-Date: Thu, 4 Dec 2014 17:24:02 -0500
Oops i forgot to ask if i should remove this from MX records, and in email routing should i select “automatically detect” or “local mail exchanger”
ipixio.in
Hello Om,
Thanks for contacting us. At the time I looked up the MX records for the domain.in, it was:
10 inbound.Domain.in.netsolmail.net
Wherever the email is hosted, just use their specific MX record settings. If you are not sure what they should be, the email host should be able to provide them to you.
We are happy to help further, but will need to review the bounce messages to help narrow down the problem.
Also, our bounceback parser tool can help determine the cause of returned/bounced messages.
Thank you,
John-Paul
Hello Om,
Thank you for contacting us. Your Email Routing setting for domain.in, should be set to Remote Mail Exchanger. Since the email is not handled on our servers.
Yes, you absolutely want to delete the following record:
0 domain.in
This will override all other MX entries, since the zero (0) record is used first, when attempting to deliver mail.
Thank you,
John-Paul
Thanks for the help – while domain.in is redirecting to domain.co we again have mail havoc – domain.in mais are bouncing.
When i saw on registrar a/c the MX entry was inbound.promizon.com.netsolmail.net
instead of inbound.domainname.com.netsolmail.net you had suggested – am i missing something?
Okay what i’ve done is changed Domain.in as the primary domain (just clarifying since we were using dummy domain Domain.com as primary domain) and Domain.co is anyway the add-on domain, and inside the cPanel i’ve set the redirect from Domain.in to Domain.co in IMH panel.
I’ve also updated MX records for Domain.in as you advised, and now i don’t think i need to again do the .htaccess redirect since it’s already taken care of.
So, after leaving a gap of few hours, I think i should simply update the nameservers of Domain.in to NS.InmotionHosting.com and NS2.inmotionhosting.com
Am i correct or still missing something here?
May i also request you to edit my comments and replace Domain with Domain, Registrar1 with Registrar 1, and Registrar2 with Registrar 2 because i don’t want this to be publicly posted forever – just posted exact things to help you understand the exact problem.
Hope you’d understand 🙂
Hello Om,
Yes, that sounds like your solution should work fine. This way the .in will display .co, but the MX records for .in should keep mail as it is. Once pointed to our name servers, then everything should work as you desire.
Kindest Regards,
Scott M
Nope actually i used the “Domain Forwarding” option on Registrar1 domain panel. Regsitrar2 panel sucks and I can’t access .htaccess file over there, nor able to set a domain forwarding instruction from there either.
When i see domains under my Network Solutions account, it shows EMPTY, which is also baffling me out, and only landing page files are uploaded via FTP and the email is setup.
Now without touching Domain.in emails, can i somehow forward Domain.in to Domain.co so that if anybody visits Domain.in he/she sees contents of Domain.co (I’m not worried about any masking – 302 redirect will do)
Hello Om,
I looked up both your domains, and they are both registered with Registar1. This is most likely why it is not listed with Registrar2, but is really just a guess.
There are several ways to accomplish this, but this is the most common way:
Add Domain.in to your cPanel as an Addon Domain.
Create the following MX record for Domain.in:
10 inbound.Domain.in.netsolmail.net
(This is what the domain is currently using.)
Then, create the .htaccess redirect rule as described above, for Domain.in.
Allow up to 24 hours for this update to propagate.
Finally, point Domain.in to the Nameservers for InMotion Hosting. Within 24 hours the domain will be redirected to your Domain.co website. Email should continue working, since we already set the MX records up previously.
Thank you,
John-Paul
No John i don’t want Domain.in mails to be hosted where Domain.co is!
I want Domain.in mails to be “AS THEY ARE” untouched, and just redirect/forward visitors from Domain.in to Domain.co (which is hosted on IMH and up-and-running as expected with separate mail server and everything)
Both domains are registered with Registrar1, Domain.in hosted with Registrar2, Domain.co hosted with InMotion.
I tried setting up domain forwarding on Registrar1 Domain.in to Domain.co but Domain.in is still displaying old contents of the website despite waiting for over 24 hrs. So, i don’t think domain propagation is happening.
Does that clarify my question?
Thanks,
Om
Hello Om,
Thank you for contacting us. All the of the redirects described on this page will redirect domains, but not affect email.
I am happy to help, but will need some additional information, to help narrow down the issue.
What type of redirect are you setting up with Registrar1? Is it one of the ones explained above? Which one?
Thank you,
John-Paul
We have a domain Domain.in on Registrar1, hosted with Registarar2 with a landing page but emails configured, and now wish to just redirect the same to Domain.co, without disturbing the mails and letting them be hosted with Network Solutions.
I’ve just set a domain forwarder from Domain.in to Domain.co in Registrar1, and Domain.co is hosted with InMotion but registered on Registrar1 and is working fine since I’ve set the Name Servers to point to IMH.
However, if i point the nameservers on Domain.in also, then it screws up the MX records and mail propagation.
Am i doing something wrong – should i do anything else except the domain forwarding?
Hello Om,
Thank you for contacting us today. The MX record for Domain.co, is as follows:
0 Domain.co
This means that the email is going to be hosted wherever Domain.co is hosted.
If you want to host it elsewhere, create a subdomain, for example:
mail.Domain.co
This subdomain must be created with your DNS host, and your registrar.
Then, point the ‘A record’ for mail.Domain.co to the server that is hosting the email.
Thank you,
John-Paul
How do you redirect ALL other domains to a new domain? These example reference how to redirect a domin if you know the domain that will be used first.. What if you don’t know the domain, or have too many to add/update?
It is a much better idea to add each domain that you are redirecting from as a RewriteCond, but to redirect all domains, you would simply use the following:
RewriteRule ^(.*) https://DomainB.com/$1 [P]
Thanks Scott…I really appreciate your help… I am also facing problems in making URLs seo friendly by trailing slash and removing extensions from URLs by trailing slash.. The code i am using in my .htaccess is
Options +FollowSymLinks
Options -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/.]+)/$ $1.php
RewriteRule ^([^/.]+)/([^/.]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
RewriteRule ^/([a-zA-Z0-9]+)/$ vendorlist.php?bcat=$1
RewriteRule ^([^/.]+)/([^/.]+)/?$ /vendor.php?bcat=$1&vendor=$2
It only remove extensions if i use it written as above. In case using seo friendly urls it gives an error 404. But if i change code like this
Options +FollowSymLinks
Options -Multiviews
RewriteEngine on
RewriteRule ^/([a-zA-Z0-9]+)/$ vendorlist.php?bcat=$1
RewriteRule ^([^/.]+)/([^/.]+)/?$ /vendor.php?bcat=$1&vendor=$2
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/.]+)/$ $1.php
RewriteRule ^([^/.]+)/([^/.]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
Then it only make urls SEO friendly. Error 404 occurs on extension removal.
Please help me out of this, Thanks in advance….
Hello Ashish,
Thanks for the question. We unfortunately can’t write the code for you, but we do try provide solutions for articles that we provide for issue like redirects in .htaccess. In your case, if you are using a software like a ecommerce software then you may want to consider possible extensions or modules that you can add to resolve this type of problem. If you want to figure out the code, please consider this post which discusses the removal of extensions and the forcing of www and trailing slashes.
Regards,
Arnel C.
Hello ARN Priceless thanks for the link. It worked for me completely what i was looking for last almost 7 days. Thank you so much….
Example:1 not working….i Want to redirect my domain ludhianaweddingvendors.com to ludhianaweds.com keeping rest of the URL same also changing with the new URL in address bar. But m failed….Any help ?? Thanks in advnace…
Hello Ashish,
I tried the code you referenced on my server and it worked fine. This code is intended to allow a domain name different from the primary to display the content of the primary under the second name. For example, if your primary domain name is ‘example.com’ and you want to allow ‘examole.net’ to be used and show that same data, you would set it up like this:
RewriteCond %{HTTP_HOST} ^example.net
RewriteRule ^(.*) https://example.com/$1 [P]
Setting it in reverse order causes a proxy error on the server.
Kindest Regards,
Scott M
Hi.
Question:
I have a domainA.com and changed my url to domainB.com. As i had maintained urls friendly, i want visitors on going to domainA.com/page1 to be redirected to domainB.com/page1, as the content and url are the same, just changed by domain.
Is it this that is covered on Example 1?
Hello Ricardo,
Thank you for contacting us today. Yes, that is what is is covered in Example 1: Redirect and keep everything after the URL.
If you have any further questions, feel free to post them below.
Thank you,
John-Paul
Hi,
For the moment i am using DirectAdmin, but acting as my own reseller i think i own full access to www.frituurrombout.be
The goal is to show the content of www.romboutmechelen.be but the URL bar should simply state : https://www.frituurrombout.be
For the moment there is nothing configured in www.frituurrombout.be, but in future i might want to install a WordPress site, so that i can show more pages than just the content of www.romboutmechelen.be
I like your idea of the second option in the article. But don’t know what to put in “path to get there [p]”
Can you type it out for me ?
Many thanks in advance.
Here’s my take :
Hello Peter,
The path you’re referring to has to do with the webpage that you’re trying to point to. So, if the page is in a certain folder, then path would look like this: https://www.domainname.com/folder/filename.php. I hope that helps explain the issue.
Regards,
Arnel C.
I’ve got this at the top of my .htaccess, but it’s not working. 🙁
Hello Daniel,
Thank you for your question. Your code looks pretty accurate, but you may have to add the $1 to the rewrite condition. For example:
# Turn on the Rewrite Engine
RewriteEngine On
RewriteCond %{HTTP_HOST} ^tomorrow.coe.uga.edu/$1
RewriteRule ^(.*) https://www.coe.uga.edu/$1 [P]
If you have any further questions, feel free to post them below.
Thank you,
-John-Paul
Still didn’t work. :\
It’s always me with the “simple” solutions failing. I swear my career is 2 years behind because of technical glitches outside my control. 🙂
Hello Daniel,
Thank you for the additional information. Since it depends on your actual site, there is most likely something inferfering with the code.
For example, if you are using a CMS such as WordPress, or Joomla, or Concrete5, they have rules in place already.
You could also have other rules in the .htaccess causing problems, you should check them as well.
Can you provide a link to the website so we can test it out?
If you have any further questions, feel free to post them below.
Thank you,
-John-Paul
How is this different from doing a plain redirect? Is it possible to show contents from DomainB but show DomainA url?
Hello garry,
Thank you for your question. By “plain redirect,” I think you mean creating a redirect in your cPanel. This just creates a redirect such as:
example1.com —-> example2.com
To show contents from DomainB but show DomainA url there are 2 options:
Park domain
Redirect Using .htaccess file
If you have any further questions, feel free to post them below.
Thank you,
-John-Paul