I have the same problem of this thread:
GeoIp redirect specific country Traffic to country domain?
I need to redirect users of certain country to another webpage using htaccess.
As said in that thread, after installing GeoIP, I used this code:
GeoIPEnable On
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^US$
RewriteRule ^(.*)$ http://example.com [R,L]
This works great, but only for the homepage.
But I need to redirect every page of my site.
I tried adding this: http://www.example.com/$1
but doesn't work. Still redirect only the homepage.
Could somehome can help me understanding how fix this? Thank you
Related
I got two domains. Lets say dom.com and dom.net.
Now I got alias on dom.net to dom.com, so when I come to dom.net it shows me dom.com - this is set on admin's webpage.
But I need when somebody comes from dom.net redirect him to dom.com/test/example.html.
My .htacces file is blank now.
Is it possible to do this using .htacces and how can it be done?
I got it!
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} dom.net$
RewriteRule ^(.*)$ http://www.dom.com/test$1 [R=301,L]
this code redirect me to test folder but still don't know how to redirect to .html page
I have set up multi-store and it works fine except for one detail, let me explain:
I have shop 1:
http://www.shop-one.com
Shop 2:
http://www.shop-two.com
If you go to http://www.shop-two.com then everything works ok. However, if you go to http://shop-two.com (without www) then you get redirected to http://www.shop-one.com
That's obviously a big problem as it is likely some visitors will omit the www.
This is the post I have to find into PrestaShop posts. Here is the URL :
https://www.prestashop.com/forums/topic/233117-solved-multi-store-redirect-issue-does-not-redirect-without-www/
and my problem is the same exactly above post.
After reading all thread I have added this code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
</IfModule>
into my htaccess file but , it's not resolved my problem.
Here are my domains:
ecopelletstoves.com
gardenfurniturefrance.com
gardenfurnitureportugal.com
These all domains going to redirect to this domain :
http://www.gardenfurniturespain.com/
and this is my default shop
http://www.gardenfurniturespain.com/
If I used it with www it's working fine. I am using multistore shop with PrestaShop.
You need to add both www.shop-two.com and shop-two.com to the desired shop URL's.
Any other subdomain/URL pointing to the server will redirect to default shop.
My website was on a subdomain, like this: mysite.primarydomain.com. The primarydomain.com DNS was managed by a third party who owns the primarydomain.com url.
My new website is now on on mysite.com. I had the third party add an a record that points mysite.primarydomain.com to my new website's IP address. How can I then redirect that mysite.primarydomain.com domain to mysite.com? Would that be via htaccess? Or via cpanel configuration?
Thanks!
There's probably a cpanel configuration to do this pretty easily, probably something like this: http://docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/SetupForwarding
But you can also add an htaccess file to the document root of the mysite.primarydomain.com site, that says:
Redirect 301 / http://mysite1.com/
or if the document root is shared, you'll need:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite\primarydomain\.com$ [NC]
RewriteRule ^(.*)$ http://mysite1.com/$1 [L,R=301]
Thanks Jon Lin for your answer. It inspired me to find a very easy method in cpanel...
In the primarydomain.com, I created a subdomain for "mysite.primarydomain.com".
I then went to "Redirects". Since I added the "mysite." subdomain, it gave me the option to create a redirect using that subdomain. So I created a redirect for mysite.primarydomain.com to point to mysite.com.
I then was able to create a few other redirects to help keep some of their old links live, such as "mysite.primarydomain.com/about".
Thanks!
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain.domain\.com$ [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]
I have two domains example.uk.net and example.co.uk - the example.uk.net has been in use since the website was started but i want to change over to the .co.uk version now - both domains are currently pointing to the same IP/sever - you see the same website on both domains...
Now i know i need to 301 redirect from the .uk.net to the .co.uk but i've read that it is best to do this page by page to retain google rankings/listings and also it is best practise anyway now i just can't seem to get this working as both domains point to the same site i can't use rewrite rules in the htaccess file such as...
Redirect 301 /get-a-quote/ http://example.co.uk/get-a-quote/
i also seem this piece of code on here that did seem to work but only for the main page, not any sub pages also it still doesn't work on a per page basis only redirecting the whole site...
RewriteCond %{HTTP_HOST} !^example\.co\.uk$ [NC]
RewriteRule ^(.*)$ http://example.co.uk$1 [R=301,L]
If anyone could help me out that would be brilliant or if someone has handled something similar in the past - any pointers would be awesome...
Thanks
You were missing a /:
RewriteCond %{HTTP_HOST} !^example\.co\.uk$ [NC]
RewriteRule ^(.*)$ http://example.co.uk/$1 [R=301,L]
I created a Wordpress blog on http://staging.mydomain.com and now that the website is ready i want all the pages to point to http://www.mydomain.com . I configured Wordpress to do that,the problem is that Google already index http://staging.mydomain.com articles and i want the pages to redirect to http://www.mydomain.com/Name-of-the-article
I search around and found that I need to do a 301 redirection via a htaccess but I don't know what to write.
Thank you for taking the time to read my answer.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^staging.mydomain.com$
RewriteRule ^(.*)$ http://mydomain.com/$1 [R=permanent,L]