Not sure how it happened, but Google has indexed my site both by IP address and domain name
and in some search in Google I see my site like 121.12.12.123/tech/tech.php.
Please let me know how can I redirect it to my domain?
121.12.12.123 redirect to www.mydomain.com
121.12.12.123/* redirect to www.mydomain.com/*
If your site is running on a apache webserver, you could use mod_rewrite and put something like this in your .htaccess:
RewriteCond %{HTTP_HOST} ^121\.12\.12\.123
RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L]
Related
I have the following issue and can't find a solution. Also I am not sure if this does work at all.
I have two domains. domain.de and domain.com
The german site has the domain domain.de. As soon as the domain domain.com is being used the redirect shall be to domain.com/en/. In other words. Only if the domain.com is used it shall be redirected to domain.com/en/.
But at the same time there are other URLs. e.g. domain.com/en/about-us/ .. or domain.com/it/bieno/. They all should not be affected.
Is it possible to redirect only the domain domain.com to domain.com/en/ and at the same time all other URLs would still be working?
It is a TYPO3 9.x installation btw. Perhaps I can solve this in TYPO3?
Eric
If you're using Apache (or a different webserver which supports this) you can use mod_rewrite to achieve this by adding the following to your .htaccess (replacing the domains of course):
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
Rewriterule ^/?$ https://example.com/en/ [L,R=301]
The RewriteCond checks if the domain is example.com or www.example.com. If you only need it to work for example.com, you can remove (www\.)?. ^/?$ checks if the requested path is / or empty.
If you use the default .htaccess for TYPO3, you don't need RewriteEngine On, but you will need to add this somewhere after the existing RewriteEngine On and before RewriteRule ^.*$ %{ENV:CWD}index.php [QSA,L]. I'd add it right after RewriteEngine On.
I am getting this error in cpanel in the Add Redirect section after creating an add-on domain:
There was an error adding the redirect. Redirecting "https://example.com"
will cause a redirection loop because "http://.*/", which is located at
"/home/folder/", is above "https://example.com", which is located at
"/home/folder/"
Type = Permanent (301) redirection
All Public Domains
Redirects to: "https://addonDomain"
Wild Card Redirect
Preferably through cpanel, the goal is to redirect only through 301 redirect, for SEO purposes, and redirect the primary domain to the add-on domain. How to fix this loop? Thanks!
You can use via .htaccess
Edit with this code:
#Force www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301,NC]
Change yourdomain.com with your domain name. This work for me.
Say I have two servers, each with its own website, that share a domain name (www.sitename.com). As far as I know, you can only point the domain name to one of the servers.
Is it possible to point individual page url's (www.sitename.com/page) to either server through htaccess, DNS records, or otherwise?
Thanks for any input.
I have achieved this via .htaccess file, in which i redirected my website to IP address and then to sub-domain, use can make use of the same.
RewriteEngine on
RewriteOptions inherit
RewriteCond %{HTTP_HOST} ^hardworkerz\.net$ [OR]
RewriteCond %{HTTP_HOST} ^www\.hardworkerz\.net$
RewriteRule ^/?$ "https\:\/\/103\.7\.129\.132\/CorporateUI" [R=301,L]
In this redirection code i have redirected my website hardworkerz.net and www.hardworkerz.net to IP address 103.7.129.132 and further to subdomain CorporateUI permanently.
I have a domain registered with godaddy and I am facing some problem in redirecting www.mydomain.com to mydomain.com
I have tried to redirect it by creating an A host record and CNAME records but it is not working. I am unable to find out the solution to this problem.
Also I have tried doing this by .htaccess file and PHP but still not able to do so.
thanks in advance!
You can't redirect via DNS records, DNS records can only "resolve" the host.domain to an IP.
To redirect www.domain.com to domain.com use something like this in the website's VirtualHost, or in the .htaccess file (if the .htaccess is enabled for rewriterules)...
RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain\.com [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
This will redirect all the ServerAliases to domain.com.
mod_rewite needs to be loaded.
If you already have domain.com pointing to to the correct site (ie. when you go to domain.com you get to the correct site) then all you need to do is have a 301 Redirect from www.domain.com to domain.com. It should be found under URL Forwarding on GoDaddy.
Otherwise you would begin by setting a CNAME record on domain.com to point to your site and then proceed with the 301 Redirect described above.
#All thanks for the replies.
I just figured it out my self.
It was quet simple. I just deleteed the previous forwarding and re entered the forwarding settings.
also i created a .htaccess file and put a statement in it.
Redirect http://www.domain.com http://domain.com
My domain http://vietnam.asiastreetfood.com works fine. But if somebody calls http://www.vietnam.asiastreetfood.com theres an error. I cannot enter www.vietnam as a subdomain at 1und1.de. So any ideas how i can redirect the www to the non-www domain?
This is what i tried:
RewriteCond %{HTTP_HOST} ^www\.vietnam.asiastreetfood\.com [NC]
RewriteRule (.*) http://vietnam.asiastreetfood.com/$1 [R=301,L]
I think that 'www' is technically a subdomain itself or at least a prefix not generally used with a "sub-domain", so in order to get www.sub.domain.com you have to configure a vhost on the server (much more complicated than an htaccess). Here is a Media Temple article I found as a starting point.
But this won't be possible on 1und1.de - you will have to contact their support and see if they can configure this (unlikely).