Project

General

Profile

« Previous | Next » 

Revision 8000

web/main/.htaccess: translate dotpaths to /-paths: Translate all .-separated components in the path to / instead of just those that exist in the filesystem. This allows per-source rules to match just a / for the path-element separator instead of sometimes / and other times . (depending on whether that portion of the dotpath had been translated). Support [] escapes that preserve any . they surround, e.g. a.[b.c] -> a/b.c . (Supporting []-escapes requires that the /-path be "sealed" by appending a / , to prevent the . -> / translation rule from reinterpreting a newly-unescaped [] sequence as a dotpath. This also requires that the translation rule ignore anything before the last /, because it could have been []-unescaped by a previous round of mod_rewrite, e.g. in another dir. All the per-source rules need to be retrofitted to support the new trailing / .) Note also the discardpath flag (http://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_dpi) on all RewriteRules that perform a replacement on the input string (i.e. that have a pattern other than ^.*$). This flag is needed to avoid infinite loops, because otherwise, a critical bug in mod_rewrite causes it to reappend the filename portion of the input string (PATH_INFO) to the result, causing it to be present twice, e.g. a/b -> a/b/b (https://issues.apache.org/bugzilla/show_bug.cgi?id=38642).

View differences:

web/main/SALVIAS/.htaccess
1 1
Redirect /SALVIAS/db    /servers/nimoy/salvias_plots
2 2
Redirect /SALVIAS/users /servers/nimoy/salvias_users
3 3

  
4
RedirectMatch ^/SALVIAS/$ http://salvias.net/Documents/salvias_data_dictionary.html
5
Redirect       /SALVIAS/  http://salvias.net/Documents/salvias_data_dictionary.html#Plot_
4
RedirectMatch ^/SALVIAS/$       http://salvias.net/Documents/salvias_data_dictionary.html
5
RedirectMatch ^/SALVIAS/(.+?)/$ http://salvias.net/Documents/salvias_data_dictionary.html#Plot_$1
web/main/.phpMyAdmin/.htaccess
1
RedirectMatch ^/\.phpMyAdmin/\[(.*)\]/([^/.]*)[/.]([^/.]*)[/.](.+)$ $1/?db=$2\&table=$3\&column=$4\&target=tbl_structure.php
2
RedirectMatch ^/\.phpMyAdmin/\[(.*)\]/([^/.]*)[/.](.+)$             $1/?db=$2\&table=$3\&target=tbl_structure.php
3
RedirectMatch ^/\.phpMyAdmin/\[(.*)\]/(.+)$                         $1/?db=$2\&target=db_structure.php
4
RedirectMatch ^/\.phpMyAdmin/\[(.*)\]/$                             $1/?target=server_databases.php
1
RedirectMatch ^/\.phpMyAdmin/\[(.*)\]/([^/]*)/([^/]*)/(.+)/$ $1/?db=$2\&table=$3\&column=$4\&target=tbl_structure.php
2
RedirectMatch ^/\.phpMyAdmin/\[(.*)\]/([^/]*)/(.+)/$         $1/?db=$2\&table=$3\&target=tbl_structure.php
3
RedirectMatch ^/\.phpMyAdmin/\[(.*)\]/(.+)/$                 $1/?db=$2\&target=db_structure.php
4
RedirectMatch ^/\.phpMyAdmin/\[(.*)\]/$                      $1/?target=server_databases.php
web/main/TCS/.htaccess
1
Redirect /TCS/ http://www.tdwg.org/standards/117/download/#/v101.xsd#
1
RedirectMatch ^/TCS/(.+?)/?$ http://www.tdwg.org/standards/117/download/#/v101.xsd#$1
web/main/VegX/.htaccess
1
Redirect /VegX/ http://wiki.tdwg.org/twiki/pub/Vegetation/WebHome/VegX_Schema_1.5.3_proposed.zip#/veg.xsd#
1
RedirectMatch ^/VegX/(.+?)/?$ http://wiki.tdwg.org/twiki/pub/Vegetation/WebHome/VegX_Schema_1.5.3_proposed.zip#/veg.xsd#$1
web/main/.htaccess
25 25
RewriteCond %{REQUEST_FILENAME} -l
26 26
RewriteRule ^.*$ - [last]
27 27

  
28
# translate dot-paths to dirs when they exist in the filesystem
29
# each subdir Redirect directive needs a corresponding tree of (empty) dirs
30
RewriteCond %{DOCUMENT_ROOT}/$1 -d [ornext]
31
RewriteCond %{DOCUMENT_ROOT}/$1 -l
32
RewriteRule ^([^.]*)\.(.*)$ $1/$2 [next]
33
	# next: if match, repeat until no more replacements
28
# translate dotpaths to /-paths (the dotpath follows the last /)
29
# replace all unescaped . with /
30
RewriteRule ^((?:.*/)?(?:[^.\[\]/]+|\[[^\[\]/]*\])+)\.([^/]+)$ $1/$2 [discardpath,next]
31
	# discardpath: avoids infinite loop with paths like a/b.c
32
# seal the /-path so the filename part is not reinterpreted as a dotpath
33
RewriteRule ^.*[^/]$ $0/
34
# remove all [] escapes (but leave empty [])
35
RewriteRule ^(.*)\[([^\[\]]+)\](.*)$ $1$2$3 [discardpath,next]
34 36

  
35 37
# non-filesystem paths
36 38
ErrorDocument 404 /
web/main/DwC/.htaccess
1
Redirect /DwC/history/ http://rs.tdwg.org/dwc/terms/history/#
2
Redirect /DwC/         http://rs.tdwg.org/dwc/terms/#
1
RedirectMatch ^/DwC/history/(.+?)/?$ http://rs.tdwg.org/dwc/terms/history/#$1
2
RedirectMatch ^/DwC/(.+?)/?$         http://rs.tdwg.org/dwc/terms/#$1

Also available in: Unified diff