Having Problems With Redirects Using .htaccess

Need to use .htaccess to redirect a specific link. Everything I have tried will not work. Any ideas? Thanks

Need to use .htaccess to redirect a specific link. Everything I have tried will not work. Any ideas? Thanks

Can you post an example of the redirection line?

Please specify the rule for the redirection

i also have problem with redirection.

i use geoip_mod2 and it is installed correctly with easyapache 4.

if someone visit main page it gets blocked, but if he knows the link for a product, let's say: www.mysite.com/product.html

then he is not get blocked and can see the page!

I add this code in main folder's .htaccess

GeoIPEnable On

Canada

RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CA$
RewriteRule ^/?$ “http://ca.diamandino.gr/” [R=301,L]

GeoIPEnable On
# Put countries to deny here      
SetEnvIf GEOIP_COUNTRY_CODE CN DenyCountry  
SetEnvIf GEOIP_COUNTRY_CODE KR DenyCountry  
SetEnvIf GEOIP_COUNTRY_CODE KP DenyCountry  
  
Allow from all  
Deny from env=DenyCountry

this rule does not even work. I have tried it

this rule does not even work. I have tried it

do you have CSF firewall installed on your server?

Finally i managed to block the countries i wanted and allow the IPs i want direct from

ModSecurity, it is better so the IPs are block before even reach websites.

For people are interested:

1. Install the mod_geoip2

2. Install ModSecurity to your server and add to geolocations the path from GeoIP: example: /usr/share/GeoIP

3. the go to ModSecurity tools and add rule (add as many countries as you need):

# Test IP address and block by country code
SecRule REMOTE_ADDR "@geoLookup" "phase:1,chain,id:1,drop,log,msg:'Blocking %{geo.country_code}'"
SecRule GEO:COUNTRY_CODE "@pm CN KR KP IN"