Last active
November 3, 2016 14:58
-
-
Save fredbradley/b19de88fb0cae70d633f60302e42b7b5 to your computer and use it in GitHub Desktop.
I'm really hoping someone with more htaccess knowledge than me can help me out!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###### | |
# Ok I'm hoping someone might be able to help. Here's the final require scenario | |
# 1. If someone tries to visit either www.domain1.org/ar or www.domain2.org/ar it should take them to www.domain3.org/specificpage | |
# 2. But only if they're from two certain IP ranges (our internal IP ranges). | |
# 3. It might only be if it's like 'www.domain1.org/ar'... if the user requests something further like 'www.domain1.org/archie-is-cool' it needs to go that that page. | |
# Background | |
# It's on a Wordpress Multisite install hence why there's more than one domain that could be request to the same doc_root | |
# I'm putting this above the Wordpress htaccess stuff, so that it picks it up before trying to compute Wordpress redirects. | |
# Here's what I have at the moment. For some reason it's working for 'domain2' but not for 'domain1' (I'm being sent to a Wordpress page!) | |
RewriteCond %{REMOTE_ADDR} ^2\.4\.6\.[0-24]$ [OR] | |
RewriteCond %{REMOTE_ADDR} ^1\.3\.5\.[0-24]$ | |
RewriteCond %{HTTP_HOST} ^(www.domain1.org|www.domain2.org) | |
RewriteCond %{REQUEST_URI} ^/ar [NC] | |
RewriteRule ^ https://www.domain3.org/specificpage [R=301,L] |
@samstarling No... seems to make no difference.
I converted it down into a 3 liner and it was clearer to understand and now it works.
RewriteCond %{REMOTE_ADDR} ^(2\.4\.6\.[0-24]|100\.15\.6\.[0-24])$
RewriteCond %{HTTP_HOST} ^(www.domain1.org|www.domain2.org) [NC]
RewriteRule ^ar$ https://sub.domain3.org/something-specific [R=302,L]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does it work if you anchor the end of the path regex, for example
^/ar$
?