Project

General

Profile

« Previous | Next » 

Revision 8032

web/main/**/.htaccess: Use RewriteRule instead of RedirectMatch to handle incremental redirects internally instead of issuing a (much slower) redirect to the web browser each time. This also handles edge cases better, as [last] RewriteRules can be used to control when to forward control to a subdir, and doesn't require prepending the path to the dir the .htaccess file is in. Note that this requires all gateway dirs (dirs with subdirs) to contain special RewriteRules to avoid redirecting subdir paths and handle DirectoryIndex; see web/main/DwC/.htaccess. Also note that the regexp of a catch-all RewriteRule must exactly follow the template for internal or external redirects; see web/main/SALVIAS/db/.htaccess for internal redirects and web/main/DwC/history/.htaccess for external redirects.

View differences:

web/main/SALVIAS/users/.htaccess
1 1
RewriteEngine on
2 2
RewriteOptions inherit
3 3

  
4
Redirect /SALVIAS/users/ /servers/nimoy/salvias_users/
4
RewriteRule ^(.*/)?$ /servers/nimoy/salvias_users/$0 [discardpath,noescape,last]
web/main/SALVIAS/db/.htaccess
1 1
RewriteEngine on
2 2
RewriteOptions inherit
3 3

  
4
Redirect /SALVIAS/db /servers/nimoy/salvias_plots
4
RewriteRule ^(.*/)?$ /servers/nimoy/salvias_plots/$0 [discardpath,noescape,last]
web/main/SALVIAS/.htaccess
1 1
RewriteEngine on
2 2
RewriteOptions inherit
3 3

  
4
RedirectMatch ^/SALVIAS/$        http://salvias.net/Documents/salvias_data_dictionary.html
5
RedirectMatch ^/SALVIAS/(.*?)/?$ http://salvias.net/Documents/salvias_data_dictionary.html#Plot_$1
4
# don't redirect subdir paths
5
RewriteCond %{DOCUMENT_ROOT}/SALVIAS/$1 -d [ornext]
6
RewriteCond %{DOCUMENT_ROOT}/SALVIAS/$1 -l
7
RewriteRule ^([^/]*).*$ - [discardpath,noescape,last]
8

  
9
# handle DirectoryIndex (this must be at this position in the rules)
10
RewriteRule ^(.*/)?index\.php$ $1 [discardpath,noescape]
11

  
12
RewriteRule ^(?!Plot_)(.+)/$ Plot_$1 [discardpath,noescape]
13
RewriteRule ^(?:(.*)/)?$ http://salvias.net/Documents/salvias_data_dictionary.html#$1 [discardpath,noescape,last]
web/main/.phpMyAdmin/.htaccess
1 1
RewriteEngine on
2 2
RewriteOptions inherit
3 3

  
4
RedirectMatch ^/\.phpMyAdmin/\[(.*)\]/([^/]*)/([^/]*)/(.+)/$ http://$1/?db=$2\&table=$3\&column=$4\&target=tbl_structure.php
5
RedirectMatch ^/\.phpMyAdmin/\[(.*)\]/([^/]*)/(.+)/$         http://$1/?db=$2\&table=$3\&target=tbl_structure.php
6
RedirectMatch ^/\.phpMyAdmin/\[(.*)\]/(.+)/$                 http://$1/?db=$2\&target=db_structure.php
7
RedirectMatch ^/\.phpMyAdmin/\[(.*)\]/$                      http://$1/?target=server_databases.php
4
RewriteRule ^\[(.*)\]/([^/]*)/([^/]*)/(.+)/$ http://$1/?db=$2&table=$3&column=$4&target=tbl_structure.php [discardpath,noescape,last]
5
RewriteRule ^\[(.*)\]/([^/]*)/(.+)/$         http://$1/?db=$2&table=$3&target=tbl_structure.php           [discardpath,noescape,last]
6
RewriteRule ^\[(.*)\]/(.+)/$                 http://$1/?db=$2&target=db_structure.php                     [discardpath,noescape,last]
7
RewriteRule ^\[(.*)\]/$                      http://$1/?target=server_databases.php                       [discardpath,noescape,last]
web/main/TCS/.htaccess
1 1
RewriteEngine on
2 2
RewriteOptions inherit
3 3

  
4
RedirectMatch ^/TCS/(.*?)/?$ http://www.tdwg.org/standards/117/download/#/v101.xsd#$1
4
RewriteRule ^(?:(.*)/)?$ http://www.tdwg.org/standards/117/download/#/v101.xsd#$1 [discardpath,noescape,last]
web/main/VegX/.htaccess
1 1
RewriteEngine on
2 2
RewriteOptions inherit
3 3

  
4
RedirectMatch ^/VegX/(.*?)/?$ http://wiki.tdwg.org/twiki/pub/Vegetation/WebHome/VegX_Schema_1.5.3_proposed.zip#/veg.xsd#$1
4
RewriteRule ^(?:(.*)/)?$ http://wiki.tdwg.org/twiki/pub/Vegetation/WebHome/VegX_Schema_1.5.3_proposed.zip#/veg.xsd#$1 [discardpath,noescape,last]
web/main/servers/nimoy/.htaccess
1 1
RewriteEngine on
2 2
RewriteOptions inherit
3 3

  
4
Redirect /servers/nimoy/ /.phpMyAdmin/[nimoy.nceas.ucsb.edu/phpmyadmin]/
4
RewriteRule ^(.*/)?$ /.phpMyAdmin/[nimoy.nceas.ucsb.edu/phpmyadmin]/$0 [discardpath,noescape,last]
web/main/DwC/history/.htaccess
1 1
RewriteEngine on
2 2
RewriteOptions inherit
3 3

  
4
RedirectMatch ^/DwC/history/(.*?)/?$ http://rs.tdwg.org/dwc/terms/history/#$1
4
RewriteRule ^(?:(.*)/)?$ http://rs.tdwg.org/dwc/terms/history/#$1 [discardpath,noescape,last]
web/main/DwC/.htaccess
1 1
RewriteEngine on
2 2
RewriteOptions inherit
3 3

  
4
RedirectMatch ^/DwC/(.*?)/?$ http://rs.tdwg.org/dwc/terms/#$1
4
# don't redirect subdir paths
5
RewriteCond %{DOCUMENT_ROOT}/DwC/$1 -d [ornext]
6
RewriteCond %{DOCUMENT_ROOT}/DwC/$1 -l
7
RewriteRule ^([^/]*).*$ - [discardpath,noescape,last]
8

  
9
# handle DirectoryIndex (this must be at this position in the rules)
10
RewriteRule ^(.*/)?index\.php$ $1 [discardpath,noescape]
11

  
12
RewriteRule ^(?:(.*)/)?$ http://rs.tdwg.org/dwc/terms/#$1 [discardpath,noescape,last]

Also available in: Unified diff