mirror of
https://github.com/klokantech/tileserver-php.git
synced 2025-10-16 23:36:09 +02:00
51 lines
1.7 KiB
ApacheConf
51 lines
1.7 KiB
ApacheConf
# tileserver.php integration with Apache via .htaccess
|
|
|
|
# Restrictions for data crawlers
|
|
Options -Indexes
|
|
Options +FollowSymLinks
|
|
Options -MultiViews
|
|
|
|
# Optional CORS header for cross-domain origin access to all data
|
|
#<ifModule mod_headers.c>
|
|
# Header set Access-Control-Allow-Origin *
|
|
#</ifModule>
|
|
|
|
# Mapping of the WMTS standardized URLs to real files and XML capabilities to tileserver.php
|
|
|
|
#check htaccess functionality
|
|
DirectoryIndex tileserver.php
|
|
|
|
RewriteEngine on
|
|
|
|
#some hostings require RewriteBase e.g. 1&1.com
|
|
#RewriteBase /
|
|
#RewriteBase /folder/
|
|
|
|
AcceptPathInfo on
|
|
|
|
# WMTS RESTful
|
|
# ------------
|
|
# The file can be accessed directly:
|
|
# Example: http://www.tileserver.com/grandcanyon/10/192/401.png
|
|
|
|
# map /wmts/layer/[ANYTHING]z/x/y.ext -> /layer/z/x/y.ext (WMTS ignoring tilematrixset,style,..)
|
|
# BTW This is used only by Gaia which ignores the <ResourceURL template="...">
|
|
RewriteRule ^wmts/([\w\d\._-]+)/.*?(\d+)/(\d+)/(\d+)\.(\w+)$ $1/$2/$4/$3.$5 [L]
|
|
# Example: http://www.tileserver.com/wmts/grandcanyon/style/tilematrixset/10/192/401.png
|
|
|
|
# map /layer/[ANYTHING]z/x/y.ext -> /layer/z/x/y.ext (WMTS ignoring tilematrix,style,..)
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteRule ^([\w\d\._-]+)/.+?(\d+)/(\d+)/(\d+)\.(\w+)$ $1/$2/$3/$4.$5 [L]
|
|
# Example: http://www.tileserver.com/grandcanyon/style/tilematrixset/10/192/401.png
|
|
|
|
# rewrite .jpeg -> .jpg
|
|
RewriteRule ^(.+).jpeg$ $1.jpg [L]
|
|
|
|
# Not modified HTTP 302
|
|
RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]
|
|
RewriteRule .* - [E=HTTP_IF_NONE_MATCH:%{HTTP:If-None-Match}]
|
|
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
RewriteCond $1 !^(tileserver\.php)
|
|
RewriteRule ^(.*)$ tileserver.php/$1 [L] |