IET-OU/open-media-player/2.x/.htaccess - Htaccess File

IET-OU/open-media-player/2.x/.htaccess

##
## Open Media Player - Apache/ httpd configuration.
##
## https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess
##

# Set on IT-EUD hosting.
##SetEnv  OUENV  iet-test

# Disable OU-SAMS authentication.
<IfModule mod_access_sams.c>
    DISABLE_SAMS
</IfModule>

# Cross-origin/-domain client access to captions/subtitle files.
<IfModule mod_headers.c>
    <FilesMatch ".(vtt|srt|ttml|xml|md)">

        # CORS header(s) - privileged origin - live/production/test.
        # http://www.cameronstokes.com/2010/12/26/cross-origin-resource-sharing-and-apache-httpd/
        SetEnvIf Origin "https?://(.*.open.ac.uk|.*.open.edu)$" AccessControlAllowOrigin=$0
        # (CORS - development only.)
        ##SetEnvIf Origin "https?://(.*.open.ac.uk|.*.open.edu|dl.dropbox(usercontent)?.com)$" AccessControlAllowOrigin=$0
        Header set Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
        # CORS wildcard - NON-privileged origin - this doesn't work with credentials!
        Header set Access-Control-Allow-Origin * env=!AccessControlAllowOrigin

        Header set Access-Control-Allow-Credentials "true" env=AccessControlAllowOrigin
        ##Header set Content-Type "text/vtt; charset=utf-8"

        # Prevent ALL caching - to ensure CORS headers are sent :(.
        Header set Cache-Control "no-cache, no-store"
        <IfModule mod_expires.c>
            ExpiresActive on
            ExpiresDefault          "access plus 0 seconds"
            ExpiresByType text/vtt  "access plus 0 seconds"
        </IfModule>
        ##Header set Expires "access plus 0 seconds"
        ##Header unset Expires

        AddDefaultCharset UTF-8
    </FilesMatch>
</IfModule>

#<FilesMatch ".*.(vtt|srt)$">
#    ForceType "text/vtt; charset=utf-8"
#</FilesMatch>

# Set correct Content-Type for captions/subtitles.
<IfModule mod_mime.c>
    AddType text/vtt  vtt
    AddType text/vtt  srt
    AddCharset utf-8  vtt
    AddCharset utf-8  srt
</IfModule>

# Deny OR Allow Folder Indexes.
# Since we disable access to PHP files you
# can leave this on without worries.
# OR better yet, create a .htaccess file in
# the dir you want to allow browsing and
# set it to +Indexes
Options -Indexes

Options +FollowSymLinks

# Set the default file for indexes
DirectoryIndex index.php index.html index.htm

#<Directory application/assets/>
#    Allow from all
#</Directory>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
    #php_value magic_quotes_gpc       0
    #php_value register_globals       0
    #php_value session.auto_start     0
    php_value  arg_separator.input  ";&"

    # Set this for the moment, NDF 2012-04-28.
    # Not compatible with OU-IT hosting.

    # Still some <?= syntax in theme-views (<?= supported in PHP 5.4 without this
    # setting, http://php.net/manual/en/ini.core.php#ini.short-open-tag )
    # (Temporary - not supported by OU-IT hosting.)
    php_value  short_open_tag         1
</IfModule>

<IfModule mod_rewrite.c>
    # mod_rewrite rules
    RewriteEngine on

    # The RewriteBase of the system (if you are using this sytem in a sub-folder).
    # RewriteBase /CodeIgniter_1.6.3/

    # This will make the site only accessible without the "www."
    # (which will keep the subdomain-sensive config file happy)
    # If you want the site to be accessed WITH the "www."
    # comment-out the following two lines.
    #RewriteCond %{HTTP_HOST} ^www.mediaplayer.open.edu$ [NC]
    #RewriteRule ^(.*)$ http://mediaplayer.open.edu/$1 [L,R=301]

    # If a controler can't be found - then issue a 404 error from PHP
    # Error messages (via the "error" plugin)
    # ErrorDocument 403 /index.php/403/
    # ErrorDocument 404 /index.php/404/
    # ErrorDocument 500 /index.php/500/

    # Deny any people (or bots) from the following sites: (to stop spam comments)
    # RewriteCond %{HTTP_REFERER} nienschanz.ru [NC,OR]
    # RewriteCond %{HTTP_REFERER} porn.com
    # RewriteRule .* - [F]
    # Note: if you are having trouble from a certain URL just
    # add it above to forbide all visitors from that site.

    # You can also uncomment this if you know the IP:
    # Deny from 192.168.1.1

    # If the file is NOT the index.php file
    #RewriteCond %{REQUEST_FILENAME} !index.php
    # Hide all PHP files so none can be accessed by HTTP
    #RewriteRule (.*).php$ index.php/$1

#ou-specific. For images, styles, scripts, SWFs.

    RewriteRule  ^(assets|X-engines|X-themes)(/.*)$  application/$1$2  [QSA,L]
    RewriteRule  ^engines/(mediaelement/.*)$  vendor/johndyer/$1  [QSA,L]
    RewriteRule  ^(themes/.*)$  vendor/iet-ou/open-media-player-themes/$1  [QSA,L]

    RewriteRule ^swf/(.*)$  application/assets/flowplayer/$1 [QSA,L]

  ##RewriteRule (crossdomain.xml)  application/assets/$1 [QSA,L]

    RewriteRule ^scripts/jquery.oembed.js(.*) index.php/scripts/jquery_oembed$1 [QSA,L]
    #RewriteRule ^scripts/(jquery.oembed.js)$ application/assets/client/$1 [QSA,L]

    RewriteRule ^ou-embed.css$ application/assets/client/site-embed.css [QSA,L]
#ou-specific ends.

    # If the file/dir is NOT real go to index
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [QSA,L]

</IfModule>

# If Mod_rewrite is NOT installed go to index.php
<IfModule !mod_rewrite.c>
    ErrorDocument 404 index.php
</IfModule>

On Github License

Files

Download PDF of Htaccess file
ENV, HTTP_HOST, HTTP_REFERER, no-cache, REQUEST_FILENAME

Comments

Apache