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).
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.
Hi im hosting my site in bluehost, I have a problem with http to https redirect. I tried to create a redirect in htaccess and I get a redirect loop. When I remove my htaccess redirect and tried to put https://mysite.com I think it redirects me to http. But I can't seem to find where did that redirect happens, is it possible that it is because of dns record?
UPDATE:
also how can I put the padlock instead of the blank white paper in the browser url.
Try the following:
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Here, we set all visiting browsers to WWW.domainname.ext
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Good luck! I hope this solves your problem.
If there is an A-record on www.yourdomain.com, it will overrule your HTACCESS.
I ran a duplicate checker for my website and got the following message
WWW/NonWWW Header Check: FAILED Your site is not returning a 301
redirect from www to non-www or vice versa. This means that Google may
cache both versions of your site, causing sitewide duplicate content
penalties.
Is this something that i should be worried about and if so how should i fix it ?
You shouldn't be worried about it, allot of sites are configured that way and google knows that.
However you can still add this if you want to be safe and send your visitors and google always go to example.com instead of www.example.com
Add this to your .htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
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]
Let's say I have the domain "example.com"
I would like to add a route such as when the URL is "example.com/whatever/follows" it redirects to "http://www.example.com/whatever/follows" (forwarding the query strings too).
Basically I would like to translate into Zend the following Apache Rewrite rule:
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,NC]
How can we do that if possible at all?
Cheers,
I would recommend to keep it as a apache rule, as it is faster and is the correct way to do. WWW is actually a subdomain value not an optional feature and it should not be present, unless you want the subdomain.
Also check the no-www site.