Help with Rewrite Rule and Geoip - Ban a page from coutries

Hello,

I'm trying to redirect users from some countries from the registration page to a specific page using mod_geoip, but something is wrong because is not redirecting:

  <ifmodule mod_geoip.c="">RewriteEngine on
    RewriteCond %{QUERY_STRING} ^app=core&module=global§ion=register$
    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(A|B!C)$
    RewriteRule ^(.*)$ http://www.domain.com/page/manual-registration.html [L]</ifmodule> 

Can this be placed anywhere in vhosts or it need to be inside ?

Should I use FilesMatch instead (if it works … I didn't test) or this does not work with query strings?

  <filesmatch "^index.php?app="core&amp;module=global&amp;section=register><quot;">RewriteEngine on
    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(A|B!C)$
    RewriteRule ^(.*)$ http://www.domain.com/page/manual-registration.html [L]</filesmatch> 

If you have better options I would like to know.

Thanks

Note: (A|B|C) are fake country codes, the GeoIP.dat is loaded and ON

0 Replies

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct