#--------------------------------------------------------------------------------------------------- # A folder-specific Apache web-server config file. Used only # when unzipped content is viewed online on the host web server. # # - Enable auto index pages when viewed in a browser # - Display (not run) python source code files # - Inherited by all subdirs: need just one at top of tree # # README oddities - though n longer so, one of the host ISPs: # - Botched UTF8 signed BOM bytes in READMEs (had to resave # some in ascii (notepad's "ansi") mode) # - Preferred an .html README over a .txt if both are present # (had to name the .txt explicitly here) # - Didn't show .html files in root in indexes if they are # prefixed by "README", due to a "IndexIgnore README* in # httpd.conf, presumably (had to rename some files "Readme*") # # Oct17: RemoveHandler was broken by godaddy relocating my site... # it can now appear just once, in the Books root folder's .htaccess; # # Feb18: Apache rewrite rule for showcode breaks Readme.txt use # here; use .html with a
 to work around till "real" page;
#
# Mar22: COPIED into _thumbspage*/ (and later, _viewable/) subfolders
# as a live .htaccess, for nicer index views of those folders directly 
# (e.g., from web host's thumbspage.html).  Else no font or spacing. 
#
# Jun25: _publish.sh now appends this with more Apache code to display 
# .html files both as plain text and nicely with script showcode.py.
# But _only_ in _viewable/'s copy; _thumbspage*/ must serve as HTML.
#---------------------------------------------------------------------------------------------------

Options +Indexes
###RemoveHandler cgi-script .py .pyw
ReadmeName _README.html


#---------------------------------------------------------------------------------------------------
# Feb18: COPIED from feb18 generated page into .htaccess of all Apache auto-index folders.
# Can't use HeaderName insert files easily: requires unique title text in each.
# This could be generated by genhtml in .., but must then be one with title for each.
# Footer: see dummy-footer-COPY (dummy_footer.html links must be "..", only one ReadmeName).
# TDB: punt on analytics js?: already run by showsource url for files themselves.
# Aug18: use new https paths for icon/css resources, not http (see root .htaccess note).
#---------------------------------------------------------------------------------------------------

# Else wrapped badly on small srceens; root .htaccess does [IndexOptions NameWidth=*]
IndexOptions +SuppressDescription +SuppressLastModified +SuppressSize

# Else whole page is sent as Latin-1 (despite ) which breaks UTF8 chars in README
IndexOptions +Charset=UTF-8

# Else list includes this (but not README.txt!) in larger programs' pages; HTML is shown
IndexIgnore _README.html

# Only 1 insert allowed (and though scantly documented, \=continuation in .htaccess).
# This adds: [unicode type, page icon, site-wide styles, mobile support, analytics].
# It _almost_ works to put all this in a separate common file referenced by HeaderName,
# but it shows up after  in , and that's wrong for  per standards.

IndexHeadInsert "\
 \
 \
\
 \
\
 \
\
 \
\
 \
 \
\
 \
 \
"

# Plus code inserted into _viewable/'s copy (only) by _publish.sh.
# Added by _publish.sh 
# Serve+show html and other files here and below as plain text, nicely

rewritecond %{HTTP_HOST} ^www.learning-python.com$ [OR]
rewritecond %{HTTP_HOST} ^learning-python.com$
rewriterule ^(?!(?:cgi\/|.*robots.txt))(_htaccess|.*\.(?:py|txt|pyw|sh|c|h|note|html))$ "https\:\/\/learning-python\.com\/cgi\/showcode\.py\?name\=trnpix/_viewable/$1" [R,NC]