Overview
Comment:Adaptations pour installations sans vhost
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 34f1936f988b9ce855e187b27e7164daf35fc1a7
User & Date: bohwaz on 2017-03-03 04:31:50
Other Links: branch diff | manifest | tags
Context
2017-03-06
21:55
Add basic unit tests + support for travis-ci check-in: 318c6e79de user: bohwaz tags: dev
2017-03-03
04:31
Adaptations pour installations sans vhost check-in: 34f1936f98 user: bohwaz tags: dev
2017-02-27
22:41
Empêcher 1password de cliquer automatiquement sur les suggestions de mot de passe check-in: 4a790d567c user: bohwaz tags: dev
Changes

Modified src/.htaccess from [a73862be8a] to [f39f249836].





1
2
3
4
5
6
7














<IfModule mod_alias.c>
    RedirectMatch 403 /include/
    RedirectMatch 403 /cache/
    RedirectMatch 403 /plugins/
    RedirectMatch 403 /templates/
    RedirectMatch 403 /*.sqlite
</IfModule>










>
>
>
>

|
|
|
|
|

>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Désactiver le multiviews (conflit avec /admin/plugin.php) et les index (sécurité)
Options -MultiViews -Indexes

# Au cas où 
<IfModule mod_alias.c>
	RedirectMatch 403 /include/
	RedirectMatch 403 /cache/
	RedirectMatch 403 /plugins/
	RedirectMatch 403 /templates/
	RedirectMatch 403 /*.sqlite
</IfModule>

# Redirection dynamique, pour les installations sans vhost dédié
# Objectif: supprimer le /www/ de l'URL
<IfModule mod_rewrite.c>
	RewriteEngine on
	RewriteBase /
	RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
	RewriteRule ^(.*)$ - [E=BASE:%1]
	RewriteRule (.*) %{ENV:BASE}/www/$1 [QSA]
</IfModule>

Modified src/include/init.php from [0a9a2da865] to [530e87cdde].

82
83
84
85
86
87
88




89
90
91
92
93
94
95
if (!defined('Garradin\WWW_URI'))
{
    // Automagic URL discover
    $path = str_replace(ROOT . '/www', '', getcwd());
    $path = str_replace($path, '', dirname($_SERVER['SCRIPT_NAME']));
    $path = (!empty($path[0]) && $path[0] != '/') ? '/' . $path : $path;
    $path = (substr($path, -1) != '/') ? $path . '/' : $path;




    define('Garradin\WWW_URI', $path);
}

if (!defined('Garradin\PREFER_HTTPS'))
{
    define('Garradin\PREFER_HTTPS', false);
}







>
>
>
>







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
if (!defined('Garradin\WWW_URI'))
{
    // Automagic URL discover
    $path = str_replace(ROOT . '/www', '', getcwd());
    $path = str_replace($path, '', dirname($_SERVER['SCRIPT_NAME']));
    $path = (!empty($path[0]) && $path[0] != '/') ? '/' . $path : $path;
    $path = (substr($path, -1) != '/') ? $path . '/' : $path;

    // Pour installations sans vhost
    $path = str_replace('/www/', '', $path);

    define('Garradin\WWW_URI', $path);
}

if (!defined('Garradin\PREFER_HTTPS'))
{
    define('Garradin\PREFER_HTTPS', false);
}

Modified src/www/.htaccess from [270ad9f48c] to [9e40080631].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Options -MultiViews -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule admin/plugin/(.*?)/(.*) /admin/plugin.php?_p=$1&_u=$2 [QSA,L]
    RewriteRule f/([\d\w]+)/(.*) /file.php?id=$1&file=$2 [QSA,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* /index.php [QSA,L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>




|
|


|





1
2
3
4
5
6
7
8
9
10
11
12
13
14
Options -MultiViews -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule admin/plugin/(.*?)/(.*) admin/plugin.php?_p=$1&_u=$2 [QSA,L]
    RewriteRule f/([\d\w]+)/(.*) file.php?id=$1&file=$2 [QSA,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* index.php [QSA,L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>