-
Notifications
You must be signed in to change notification settings - Fork 0
/
redirects.Rmd
55 lines (46 loc) · 1.56 KB
/
redirects.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
title: "Redirections dans WordPress EPFL"
author: "Dominique Quatravaux"
output:
html_document:
df_print: paged
---
```{r include, echo = FALSE, message = FALSE}
if (! exists("redirects")) {
source("htaccesses.R")
}
library(stringr)
library(forcats)
library(ggplot2)
library(ggtext)
```
# Vue d'ensemble
```{r redirects_pie, echo = FALSE}
redirects %>% count(wp_env, cmd) %>%
mutate(rank = rank(-n),
group = ifelse(rank > 5, "Autres",
str_glue("<i>{cmd}</i> dans {wp_env}")),
dagger = ifelse(wp_env == "inside" & cmd == "RewriteRule", "<sup>†</sup>", "")) %>%
mutate(.by = group, label = str_glue("{ group } ({ sum(n) }){ dagger }")) %>%
mutate(label = fct_reorder(label, desc(n))) %>%
ggplot(aes(x="", y=n, fill=label)) +
geom_bar(stat="identity", width=1) +
coord_polar("y", start=0) +
theme_void() +
labs(caption="Lignes «utiles» dans les <i>.htaccess</i>",
fill="Type et environnement",
y = "") +
theme(
legend.text = element_markdown(),
plot.caption = element_markdown()
)
```
<sup>†</sup> Après élimination des `RewriteRule`s qui servent à authentifier les accès aux média
# `Redirect`s dans www
```{r drilldown_www, echo = FALSE}
redirects %>% filter(wp_env == "www" & cmd %in% c("Redirect", "redirect")) %>% count(uri_path) %>% arrange(desc(n))
```
# `RewriteRule`s dans subdomains
```{r drilldown_subdomains, echo = FALSE}
redirects %>% filter(cmd == "RewriteRule" & wp_env == "subdomains") %>% count(host) %>% arrange(desc(n))
```