s-a-r-id/geograph-project/master/config-examples/apache/.htaccess - Htaccess File

s-a-r-id/geograph-project/master/config-examples/apache/.htaccess

#Minimal configuration required to get a running site 
# - see geograph.conf for a more complete example (if can modify httpd.conf file) 
# only use one, either geograph.conf or .htaccess
#place in the document root (eg public_html/.htaccess)

    
    #php config
    php_value include_path .:/home/www/geograph.elphin/libs/:/usr/share/pear
    php_value register_globals Off
    php_value upload_max_filesize 8M
    php_value arg_separator.output &
    php_value session.use_trans_sid  1
    #php_value phpa on

    
    RewriteEngine on

    #redirect to canonical url
    #http://httpd.apache.org/docs/misc/rewriteguide.html
    RewriteCond %{HTTP_HOST}   !^www.example.com [NC]
    RewriteCond %{HTTP_HOST}   !^$
    RewriteRule ^(.*)         http://www.example.com/$1 [L,R]
    #the following includes a fix as some useragents auto add a / to what it thinks is a folder

    RewriteRule ^photo/([0-9]+).xml /api/photo/$1 [qsa]
    RewriteRule ^api/.* /restapi.php [qsa]
    RewriteRule ^photo/([0-9]+).rdf /rdfapi.php?id=$1 [qsa]
    RewriteRule ^photo/([0-9]+).kml /kml.php?id=$1 [qsa]
    RewriteRule ^photo/([0-9]+) /view.php?id=$1 [qsa]
    RewriteRule ^gridref/([A-Za-z]{1,2})$ /myriad.php?myriad=$1 [qsa]
    RewriteRule ^gridref/(.*)/links /location.php?gridref=$1 [qsa]
    RewriteRule ^gridref/(.*) /browse.php?gridref=$1 [qsa]

    RewriteRule ^help/([^/]*) /staticpage.php?page=$1 [qsa]

    RewriteRule ^profile/([0-9]+)/feed(|/[0-9]+)/recent.([w]+) /syndicator.php?page=$2&u=$1&extension=$3 [qsa]
    RewriteRule ^feed/userid/([0-9]+)(|/[0-9]+).([w]+) /syndicator.php?page=$2&u=$1&extension=$3 [qsa]
    RewriteRule ^user/([^/]+)/map/?(.*)$ /mapbrowse.php?user=$1&t=$2
    RewriteRule ^user/([^/]+)/all/?$ /profile.php?user=$1&all=1
    RewriteRule ^user/([^/]+)/more/?$ /profile.php?user=$1&more=1
    RewriteRule ^user/([^/]+)/?$ /profile.php?user=$1

    RewriteRule ^profile/(d+)/map/?(.*)$ /mapbrowse.php?u=$1&t=$2
    RewriteRule ^profile/(d+)/all/?$ /profile.php?id=$1&all=1
    RewriteRule ^profile/(d+)/more/?$ /profile.php?id=$1&more=1
    RewriteRule ^profile/(d+)/?$ /profile.php?id=$1 [qsa]

    RewriteRule ^map/(.*) /mapbrowse.php?t=$1 [qsa]
    RewriteRule ^article/([w-]+)/?$ /article/article.php?page=$1 [qsa]
    RewriteRule ^gallery/([w-]+)/?([0-9]?)/?$ /gallery/gallery.php?url=$1&page=$2 [qsa]
    RewriteRule ^explore/places/([0-9]?)/?([w-]*)/? /explore/places.php?ri=$1&adm1=$2 [qsa]

    RewriteRule ^reg/([^/]+)/(.*) /register.php?u=$1&confirm=$2 [qsa]
    RewriteRule ^list/([A-Z]{1,2}) /list.php?square=$1 [qsa]

    RewriteRule ^credits/?([d-]*)/?$ /credits.php?when=$1
    RewriteRule ^contributors/(d+) /statistics/breakdown.php?by=user&i=$1

    RewriteRule ^content/feed/recent.([w]+) /content/syndicator.php?extension=$1 [qsa]
    RewriteRule ^article/feed/recent.([w]+) /article/syndicator.php?extension=$1 [qsa]
    RewriteRule ^events/feed.([w]+) /events/syndicator.php?extension=$1 [qsa]

    RewriteRule ^feed/recent.([w]+) /syndicator.php?extension=$1 [qsa]
    RewriteRule ^feed/recent/?([^/]*)/? /syndicator.php?format=$1 [qsa]

    RewriteRule ^feed/results/([0-9]+)(|/[0-9]+).nl$ /kml.php?page=$2&i=$1&submit=1&simple=1&type=view [qsa]
    RewriteRule ^feed/results/([0-9]+)(|/[0-9]+).([w]+) /syndicator.php?page=$2&i=$1&extension=$3 [qsa]
    RewriteRule ^feed/results([0-9]*)/([0-9]+)/?([^/]*)/? /syndicator.php?page=$1&i=$2&format=$3 [qsa]

    RewriteRule ^results/([0-9]+)(/[0-9]+|).?([w]*)$ /search.php?page=$2&i=$1&extension=$3 [qsa]

    RewriteRule ^discuss/topic([0-9]+) /discuss/?action=vthread&topic=$1 [qsa,r]
    RewriteRule ^discuss/forum([0-9]+) /discuss/?action=vtopic&forum=$1 [qsa,r]
    RewriteRule ^discuss/feed/recent.([w]+) /discuss/syndicator.php?extension=$1 [qsa]
    RewriteRule ^discuss/feed/recent/?([^/]*) /discuss/syndicator.php?format=$1 [qsa]
    RewriteRule ^discuss/feed/forum([0-9]+).([w]+) /discuss/syndicator.php?forum=$1&extension=$2 [qsa]
    RewriteRule ^discuss/feed/forum([0-9]+)/?([^/]*) /discuss/syndicator.php?forum=$1&format=$2 [qsa]

    RewriteRule ^get-juppy.jnlp /get-juppy.php [qsa]

    RewriteRule ^sitemap.xml$ /sitemap/root/sitemap.xml [L]
    RewriteRule ^sitemap(d+).xml.gz$ /sitemap/root/sitemap$1.xml.gz [L]

    #rewrite imagemap clicks as regular urls - must do this otherwise
    #php's use_trans_sid will break the urls
    RewriteCond %{QUERY_STRING} (.+)?([0-9]+),([0-9]+)$
    RewriteRule ^mapbrowse.php /mapbrowse.php?x=%2&y=%3&%1

    RewriteRule ^(.*).v[0-9]+.(css|js)$ /$1.$2 [L]

    ErrorDocument 404 /staticpage.php?page=404

  RewriteCond %{HTTP_REFERER} ^http://(.+.)?myspace.com/ [NC,OR]
  RewriteCond %{HTTP_REFERER} ^http://(.+.)?facebook.com/ [NC,OR]
  RewriteCond %{HTTP_REFERER} ^http://(.+.)?blogspot.com/ [NC,OR]
  RewriteCond %{HTTP_REFERER} ^http://(.+.)?livejournal.com/ [NC,OR]
  RewriteCond %{HTTP_REFERER} ^http://altlab.com/ [NC]
  RewriteRule /photos/.*.jpg$ /stuff/nohotlink.php [L]

On Github License

Files

Download PDF of Htaccess file
HTTP_HOST, HTTP_REFERER, QUERY_STRING, static

Comments

Apache