GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — webtrees/07_set_prettyurls.sh at webtrees-2.2 · H2CK/webtrees

Expand file tree

/

07_set_prettyurls.sh

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
59 lines (56 loc) · 2.16 KB
/

07_set_prettyurls.sh

Copy path

File metadata and controls

executable file
·
59 lines (56 loc) · 2.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
56
57
58
59
#!/bin/bash
# Checks if pretty urls should be activated, when the environment variable
# PRETTYURLS is set to TRUE. Otherwise there will be no changes in config.ini.php.
#
# When setting PRETTYURLS to true it is also necessary to set BASE_URL.
WT_BASE_URL=${BASE_URL:-FALSE}
WT_PRETTYURLS=${PRETTYURLS:-FALSE}
CONFIG_FILE=/var/www/html/data/config.ini.php
#Check if prettyurls should be set
if [ "$WT_PRETTYURLS" != "FALSE" ]
then
echo "Activate pretty urls."
#Check if not yet set, if file exists, do nothing
if [ -f "$CONFIG_FILE" ]; then
echo "Configuration file $CONFIG_FILE found."
if grep -q "rewrite_urls" $CONFIG_FILE; then
echo "Setting rewrite_urls=\"1\"."
sed -i -r 's,rewrite_urls[ ]*=[ ]*\"[a-zA-Z0-9:\/\.]*\",rewrite_urls="1",g' "$CONFIG_FILE"
else
echo "Adding rewrite_urls=\"1\"."
echo "rewrite_urls=\"1\"" >> $CONFIG_FILE
fi
else
echo "Creating the configuration file $CONFIG_FILE and setting rewrite_urls."
cp /config_blank.ini.php "$CONFIG_FILE"
echo "Adding rewrite_urls=\"1\"."
echo "rewrite_urls=\"1\"" >> $CONFIG_FILE
fi
else
echo "PRETTYURLS not explicitly activated. Nothing to do."
fi
#Check if baseurl should be set
if [ "$WT_BASE_URL" != "FALSE" ]
then
echo "Set base_url in $CONFIG_FILE"
#Check if not yet set, if file exists, do nothing
if [ -f "$CONFIG_FILE" ]; then
echo "Configuration file $CONFIG_FILE found."
if grep -q "base_url" $CONFIG_FILE; then
echo "Setting base_url=\"$WT_BASE_URL\"."
sed -i -r 's,base_url[ ]*=[ ]*\"[a-zA-Z0-9:\/\.]*\",base_url="'"$WT_BASE_URL"'",g' "$CONFIG_FILE"
else
echo "Adding base_url=\"$WT_BASE_URL\"."
echo "base_url=\"$WT_BASE_URL\"" >> $CONFIG_FILE
fi
else
echo "Creating the configuration file $CONFIG_FILE and setting base_url."
cp /config_blank.ini.php "$CONFIG_FILE"
echo "Adding base_url=\"$WT_BASE_URL\"."
echo "base_url=\"$WT_BASE_URL\"" >> $CONFIG_FILE
fi
else
echo "BASE_URL not explicitly set. Nothing to do."
fi
rm -f "$CONFIG_FILE-E"
rm -f "$CONFIG_FILE-r"
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.