Allow access control dozens of own servers/domains using htaccess - .htaccess

I want to open CORS from each of my own personal servers to one another , all servers/domains have very similar names
Instead of having to manually list 5 dozens domains , is there a way i can combine all similar names into 1 ?
Example server/domain names - all server names just use a different number after the www , so my servers have numbers ranging from www1 to www99
https://www2.mySite.com
https://www5.mySite.com
https://www11.mySite.com
https://www14.mySite.com
https://www50.mySite.com
https://www80.mySite.com

Related

Kentico 11: Multi-culture set up but need to create URL outside of a culture

We have set up Kentico 11 using cultures (we have 10 different cultures) but also need the flexibility to create a URL that does not contain a culture folder within its structure.
Current scenario:
domain.com/en-gb/pageurl
Ideal scenario:
domain.com/pageurl
How can I do this? Do I need to set up a separate subdomain?
You can use Page URL Path section of URLs tab in Pages application to define the URL you want even without language prefix. It will be unique per language. Here is the example:

dnsmasq tags and conditional dns server

As an overall solution i'd like to split dns resolving between different servers, using dnsmasq.
i.e. Default to dns server A, unless explicitly set to dns server B per host (mac).
I'd like to split my network into dnsmasq tagged subnets, for this example say:
192.168.1.80-150 = green
192.168.1.40-50 = red
I would like dhcp leases to be handed by, by -default- tagged green, except for a few specific MACs where I would like to hand out the red tag.
I have this part working successfully (I believe), where i explicitly set it by MAC - but what i would like is for everything -unless specified otherwise- to default to green.
I would then like to say "for all green tags, give them dns server A as their resolver", "for all red tags, give them dns server B as their resolver".
is this possible?
I have the following config that does not seem to work:
--8<--
dhcp-range=set:green,192.168.1.80,192.168.1.150,infinite
dhcp-range=tag:red,192.168.1.40,192.168.1.50,infinite
dhcp-option=net:green,option:dns-server,8.8.8.8,8.8.4.4
dhcp-option=net:red,option:dns-server,192.168.1.11
dhcp-host=AA:BB:CC:DD:CC:BB,redhost1,192.168.1.41,infinite,net:red
dhcp-host=BB:CC:DD:AA:BB:00,greenhost1,192.168.1.81,infinite,net:green
dhcp-option=option:router,192.168.1.1
--8<--
This does not seem to work however, I have different hosts being assigned different ip addresses based on whether i have matched their MAC, and then it seems as if the dns server is not correctly being handed out.
I believe the dns server is not being handed out because a "cat /etc/resolv.conf" on one of the hosts shows 127.0.0.1.
To summarise my queries:
Can i make everything default to 'green', unless explicitly set to 'red' by MAC (at the moment I am having to explicitly put the mac of everything into the conf file)?
Can i specify different DNS servers, for different tagged networks?
For extra clarity I am a bit confused about the different between "tag" and "set" and in googling have found references to both, a short and clean definition of these would be great.
thanks very much
ok, i fixed it (wrt my particular request) and i'll post what i've got here in case it helps someone else.
so my requirement was handing out different dns server (and perhaps different gw) to different hosts, and this seems to work:
dhcp-range=set:green,192.168.1.80,192.168.1.150,infinite
# red network
dhcp-host=11:22:33:44:55:66,hosta,192.168.1.11,infinite,set:red
dhcp-host=66:55:44:33:22:11,aa:bb:cc:dd:ee:ff,hostb,192.168.1.12,infinite,set:red
# green network mobile
dhcp-host=dd:dd:dd:dd:dd:dd,android1,192.168.1.21,infinite,set:green
dhcp-host=cc:cc:cc:cc:cc:cc,android2,192.168.1.22,infinite,set:green
unless expicility set otherwise, everything is tagged green. Some certain MACs are tagged red. Then to do the different dns server and different gw you can do:
# options
dhcp-option=tag:green,option:dns-server,192.168.1.1,192.231.a.b # ,8.8.8.8,8.8.4.4
dhcp-option=tag:red,option:dns-server,192.168.1.c
dhcp-option=tag:green,option:router,192.168.1.1
dhcp-option=tag:red,option:router,192.168.1.c
some other notes / context that i found helpful about this, and also about the net / set / tag options:
The optional set: sets an alphanumeric label which marks this network so that dhcp options may be specified on a per-network basis. When it is prefixed with 'tag:' instead, then its meaning changes from setting a tag to matching it. Only one tag may be set, but more than one tag may be matched.
More than one tag can be set in a dhcp-host directive (but not in other places where "set:" is allowed)
This system evolved from an earlier, more limited one and for backward compatibility "net:" may be used instead of "tag:" and "set:" may be omitted. (Except in dhcp-host, where "net:" may be used instead of "set:".) For the same reason, '#' may be used instead of '!' to indicate NOT.
therefore i think it's safe to just:
use set and tag, and avoid using net (since it's the old way)
use set in your dhcp-range and dhcp-host, to assign the tags, and
use tag in your options to match the tags that you've already set.
as an aside on of those dhcp-hosts you can see with multiple mac addresses, because it's the eth0 and wlan mac's for the same box.
seems to work for me anyway, perhaps this will help someone.
why not change the mind to setup 2 dhcp sections over 2 vlans with just 1 dnsmasq service, and make the 2 vlans communicate with each other through their gateways (or not).

Display all categories from one site and only a specific category from another site in Expression Engine MSM

I'm using ExpressionEngine's multisite manager and I'm displaying channel entries from two of the sites - our global site and our localized site for our Australia office. For the Australia site I would like to display all channel entries, but from the Global Site channel entries I would like to only display channel entries from a particular category (in this case "25" ie. those tagged as pertaining to Australia on our Global site).
If I use something like this below, it wont show the any of the entries from the Australia site (tpi_au) because I don't have those categorize.
{exp:channel:entries channel="success" dynamic="no" site="tpi_hq|tpi_au" category="25"}
Is there a way to make that category="25" apply only to tpi_hq?
Sorry this is probably a really easy answer or I'm just doing something totally wrong to begin with... :/
Thank you!
I don't believe there is a way to do this directly in a single channel call.
Situations like this arise all the time, not just with MSM. What if you want 10 entries for category X and 7 entries from category Y? Same deal.
Basically you need to make two channel:entries calls.
If you don't care about the order of the entries you are done. If it bothers you that the tpi_hq entries are always at the top of the list while the tpi_au entry is always at the bottom then you need to figure a way to sort them.
Two approaches I've used for this:
Sort the entries on the client side. I've done this in jQuery using html5 data-date parameters on <li>s.
Muck around with passing forward the entry ID's as embed variables. This requires a total of 3 EE channel:entry tags plus an embed so it is definitely less efficient on the server side, if you are concerned about such things.
Incidentally, most of the EE questions are now handled in the EE SE. You might get a different/better answer over there.

How to deny USA users except google bots?

As for one of my friends request i had to build a website for 3 countries in 3 sub-domains.
Like
au.example.com
us.example.com
in.example.com
All these three has common contents and some unique contents.All the traffic comes from a particular country will redirect to the related subdomain.
My problem is the google indexing. As all the traffic comes from USA will directed to us.example.com,google bots will index only us.example sub-domain.But there are lot of other contents at in.example.com. so how can I let the google to index my other 2 subdomains?
Thanks for your advices
How are you doing your location-specific sorting?
What you'll have to do is add an exception based on something, probably based on the user-agent.
However, Google has searches for all languages, so you really shouldn't worry about it. Their version of search for AU will crawl AU, etc. If you want to allow Google to index AU for its US search... that might get you in a bit of trouble with Google (and honestly, would defeat the purpose of what you are trying to achieve).

I want to show a webpage which will be visible for specific country only

I want to show a webpage which will be visible in India only and for the rest of the world it should redirect to another page ,can anybody tell me how I can add this functionality using Drupal 7 ?
You need to detect IP of user and redirect based on that. To detect IPs you can use Drupal Modules like GeoIP, SmartIP etc.. All these modules only provide APIs i.e you need to write your logic in modules/themes. Choose one for which you need least maintanence. For geoIp you need to keep updating County List DAT file manually once in 3~4 months, I am not sure about others. Once you choose your module you have to write logic for your scenario, something like this (This will redirect users only from front page i.e www.example.com, if you want you can add this to hook_init() so that its checked in all pages.
$cc = geoip_country_code();
if($cc == "IN"){
drupal_goto(MY_INDIAN_SITE_URL);
}
else{
drupal_goto(REST_OF_WORLD_PAGE);
}
You can use page--front.tpl.php or make use of drupal_is_front_page() in page.tpl.php to write your own logic.

Resources