Skip to content

Commit a60ef49

Browse files
committed
Deploy htaccess files with mod_rewrite rules
1 parent 287b53e commit a60ef49

7 files changed

Lines changed: 165 additions & 1 deletion

File tree

.github/workflows/main.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ jobs:
3535
python3 -m pip install pdm
3636
pdm install --verbose
3737
- name: Build the site
38-
run: pdm run build
38+
run: |
39+
pdm run build
40+
pdm run add_htaccess
3941
4042
# Create artifact containing output
4143
- name: Create archive for website output

mod_rewrite/.htaccess

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
RewriteBase "/"
2+
3+
RewriteRule "^documentation/dev/sphinx/html/_static/doc-versions.json$" "dev/_static/doc-versions.json" [R,L]
4+
5+
RewriteRule "^assets/img/(.*).png" "_static/img/$1.png" [R,L]
6+
RewriteRule "^assets/css/(.*).css" "_static/css/legacy/$1.css" [R,L]
7+
RewriteRule "^assets/js/copybutton.js" "_static/js/copybutton.js" [R,L]
8+
RewriteRule "^favicon.ico" "_static/img/favicon.png" [R,L]
9+
10+
RewriteRule "^documentation/docs-(\d\.\d/.*)" "$1" [R=permanent,L]
11+
RewriteRule "^documentation/release_notes/v(\d\.\d)\.\d\.html" "stable/reference/releasenotes/v$1.html" [R=permanent,L]
12+
RewriteRule "^documentation/dev/doxygen/html/(.+)" "dev/cxx/$1" [R=permanent,L]
13+
RewriteRule "^documentation/dev/sphinx/html/_tags/(.+)" "stable/_tags/$1" [R=permanent,L]
14+
RewriteRule "^documentation/?" "stable/reference/" [R=permanent,L]
15+
16+
RewriteRule "^docs/sphinx/html/index.html" "stable/reference/index.html" [R=permanent,L]
17+
RewriteRule "^docs/sphinx/html/faq.html" "stable/userguide/faq.html" [R=permanent,L]
18+
RewriteRule "^docs/doxygen/html/(.+)" "stable/cxx/$1" [R=permanent,L]
19+
RewriteRule "^stable/index.html" "stable/reference/index.html" [R=permanent,L]
20+
RewriteRule "^dev/index.html" "dev/reference/index.html" [R=permanent,L]
21+
RewriteRule "^3.1/index.html" "3.1/reference/index.html" [R=permanent,L]
22+
23+
RewriteRule "^science/?$" "stable/reference/index.html" [R=permanent,L]
24+
RewriteRule "^science/index.html" "stable/reference/index.html" [R=permanent,L]
25+
RewriteRule "^science/phases.html" "stable/reference/thermo/phase-thermo.html" [R=permanent,L]
26+
RewriteRule "^science/science-species.html" "stable/reference/thermo/species-thermo.html" [R=permanent,L]
27+
RewriteRule "^science/reactions.html" "stable/reference/kinetics/index.html" [R=permanent,L]
28+
RewriteRule "^science/reactors.html" "stable/reference/reactors/index.html" [R=permanent,L]
29+
RewriteRule "^science/flames.html" "stable/reference/onedim/index.html" [R=permanent,L]
30+
RewriteRule "^science/kinetics.html" "stable/reference/kinetics/index.html" [R=permanent,L]
31+
RewriteRule "^science/(\w+)-thermo.html" "stable/reference/thermo/$1-thermo.html" [R=permanent,L]
32+
RewriteRule "^science/thermodynamics.html" "stable/reference/thermo/index.html" [R=permanent,L]
33+
RewriteRule "^science/thermo.html" "stable/reference/thermo/index.html" [R=permanent,L]
34+
RewriteRule "^science/transport.html" "stable/reference/transport/index.html" [R=permanent,L]
35+
RewriteRule "^docs/sphinx/html/flames.html" "stable/reference/onedim/index.html" [R=permanent,L]
36+
RewriteRule "^docs/sphinx/html/reactors.html" "stable/reference/reactors/index.html" [R=permanent,L]
37+
RewriteRule "^docs/sphinx/html/python/(.+).html" "stable/python/$1.html" [R=permanent,L]
38+
39+
RewriteRule "^tutorials/input-files.html" "stable/userguide/input-tutorial.html" [R=permanent,L]
40+
RewriteRule "^tutorials/legacy2yaml.html" "stable/userguide/legacy2yaml-tutorial.html" [R=permanent,L]
41+
RewriteRule "^tutorials/yaml/yaml-format.html" "stable/userguide/input-tutorial.html" [R=permanent,L]
42+
RewriteRule "^tutorials/yaml/.*" "stable/userguide/creating-mechanisms.html" [R=permanent,L]
43+
RewriteRule "^(tutorials|docs/sphinx/html)/cxx-guide/compiling.html" "stable/userguide/compiling-cxx.html" [R=permanent,L]
44+
RewriteRule "^(tutorials|docs/sphinx/html)/cxx-guide" "stable/userguide/cxx-tutorial.html" [R=permanent,L]
45+
RewriteRule "^tutorials(.*)" "stable/userguide$1" [R=permanent,L]
46+
47+
RewriteRule "^develop/index.html" "stable/develop/index.html" [R=permanent,L]
48+
RewriteRule "^install/compiling-install.html" "stable/develop/index.html" [R=permanent,L]
49+
RewriteRule "^install/(macos|windows)-install.html" "stable/install/index.html" [R=permanent,L]
50+
RewriteRule "^install/(.+)-install.html" "stable/install/$1.html" [R=permanent,L]
51+
RewriteRule "^install(.*)" "stable/install$1" [R=permanent,L]
52+
RewriteRule "^downloads?.html" "stable/install/index.html" [R=permanent,L]
53+
RewriteRule "^docs/sphinx/html/install.html" "stable/install/index.html" [R=permanent,L]
54+
55+
RewriteRule "^(docs/sphinx/html/)?compiling/installation-reqs.html" "stable/develop/compiling/compilation-reqs.html" [R=permanent,L]
56+
RewriteRule "^sphinx/html/compiling.html"
57+
RewriteRule "^(docs/sphinx/html/)?compiling/(scons-)?(.+?)(-dev)?.html" "stable/develop/compiling/$3.html" [R=permanent,L]
58+
RewriteRule "^docs/sphinx/html/compiling.html" "stable/develop/index.html" [R=permanent,L]
59+
Rewriterule "^sphinx/html/search.html(.*)" "stable/search.html$1" [R,L]
60+
61+
RewriteRule "^blog/index.html" "news-index.html" [R=permanent,L]
62+
RewriteRule "^blog/?$" "news-index.html" [R=permanent,L]
63+
RewriteRule "^blog/(.+)" "news/$1" [R=permanent,L]
64+
RewriteRule "^categories/website.html" "news/category/website.html" [R=permanent,L]
65+
RewriteRule "^categories/(.+)\.html" "news/tag/$1.html" [R=permanent,L]
66+
RewriteRule "^authors/(.+)\.html" "news/author/$1.html" [R=permanent,L]
67+
RewriteRule "^dave.html" "dave-goodwin.html" [R=permanent,L]
68+
RewriteRule "^affiliated-packages.html" "affiliated.html" [R=permanent,L]
69+
RewriteRule "^reference/index.html" "stable/reference/index.html" [R=permanent,L]
70+
71+
RewriteRule "^science/reactors/constpresmolereactor.html" "stable/reference/reactors/constant-pressure-mole-reactor.html" [R=permanent,L]
72+
RewriteRule "^science/reactors/constpresreactor.html" "stable/reference/reactors/constant-pressure-reactor.html" [R=permanent,L]
73+
RewriteRule "^science/reactors/controlreactor.html" "stable/reference/reactors/controlreactor.html" [R=permanent,L]
74+
RewriteRule "^science/reactors/idealgasconstpresmolereactor.html" "stable/reference/reactors/ideal-gas-constant-pressure-mole-reactor.html" [R=permanent,L]
75+
RewriteRule "^science/reactors/idealgasconstpresreactor.html" "stable/reference/reactors/ideal-gas-constant-pressure-reactor.html" [R=permanent,L]
76+
RewriteRule "^science/reactors/idealgasmolereactor.html" "stable/reference/reactors/ideal-gas-mole-reactor.html" [R=permanent,L]
77+
RewriteRule "^science/reactors/idealgasreactor.html" "stable/reference/reactors/ideal-gas-reactor.html" [R=permanent,L]
78+
RewriteRule "^science/reactors/reactors.html" "stable/reference/reactors/index.html" [R=permanent,L]
79+
RewriteRule "^science/reactors/molereactor.html" "stable/reference/reactors/mole-reactor.html" [R=permanent,L]
80+
RewriteRule "^science/reactors/pfr.html" "stable/reference/reactors/pfr.html" [R=permanent,L]
81+
RewriteRule "^science/reactors/cvodes.html" "stable/develop/reactor-integration.html" [R=permanent,L]
82+
RewriteRule "^science/reactors/extensiblereactor.html" "stable/userguide/extensible-reactor.html" [R=permanent,L]
83+
RewriteRule "^science/reactors/customreactor.html" "stable/userguide/extensible-reactor.html" [R=permanent,L]
84+
RewriteRule "^science/reactors/delegatedreactor.html" "stable/userguide/extensible-reactor.html" [R=permanent,L]
85+
86+
RewriteRule "^(3.1|dev)/cython/(.+)" "$1/python/$2" [R=permanent,L]
87+
RewriteRule "^docs/sphinx/html/cython/examples/(\w+?)_(.*).html" "stable/examples/python/$1/$2.html" [R=permanent,L]
88+
RewriteRule "^docs/sphinx/html/cython/(.+)" "stable/python/$1" [R=permanent,L]
89+
90+
RewriteRule "^3.0/sphinx/html/python/(.+)" "3.0/sphinx/html/cython/$1" [R,L]
91+
92+
RewriteRule "^2.1/doxygen/html/jquery.js" "2.1/sphinx/html/_static/jquery.js" [R,L]
93+
RewriteRule "^(2.\d)/sphinx/html/cython/doxygen/html/(.*)" "$1/doxygen/html/$2" [R,L]
94+
95+
RewriteRule "^python/(onedim|kinetics|reactors|thermo|transport)/(.*)" "stable/examples/python/$1/$2" [R=permanent,L]
96+
97+
RewriteRule "^examples(|/|/index.html)$" "stable/examples/index.html" [R=permanent,L]
98+
RewriteRule "^examples/python(|/|/index.html)$" "stable/examples/python/index.html" [R=permanent,L]
99+
100+
RewriteRule "^examples/python/surface_chemistry/1D_pfr_surfchem.py.html" "stable/examples/python/reactors/1D_pfr_surfchem.html" [R=permanent,L]
101+
RewriteRule "^examples/python/surface_chemistry/catalytic_combustion.py.html" "stable/examples/python/onedim/catalytic_combustion.html" [R=permanent,L]
102+
RewriteRule "^examples/python/surface_chemistry/diamond_cvd.py.html" "stable/examples/python/kinetics/diamond_cvd.html" [R=permanent,L]
103+
RewriteRule "^examples/python/surface_chemistry/lithium_ion_battery.py.html" "stable/examples/python/kinetics/lithium_ion_battery.html" [R=permanent,L]
104+
RewriteRule "^examples/jupyter/electrochemistry/lithium_ion_battery.ipynb.html" "stable/examples/python/kinetics/lithium_ion_battery.html" [R=permanent,L]
105+
RewriteRule "^examples/python/surface_chemistry/sofc.py.html" "stable/examples/python/kinetics/sofc.html" [R=permanent,L]
106+
RewriteRule "^examples/python/multiphase/(.+)\.py\.html" "stable/examples/python/thermo/$1.html" [R=permanent,L]
107+
RewriteRule "^examples/python/multiphase/(.+)\.py" "stable/examples/python/thermo/$1.html" [R=permanent,L]
108+
RewriteRule "^examples/python/(\w+)/(.+)\.py\.html" "stable/examples/python/$1/$2.html" [R=permanent,L]
109+
RewriteRule "^examples/python/(\w+)/(.+)\.py" "stable/examples/python/$1/$2.html" [R=permanent,L]
110+
111+
RewriteRule "^examples/jupyter/flames/flame_speed_with_convergence_analysis.ipynb.html" "stable/examples/python/onedim/flame_speed_convergence_analysis.html" [R=permanent,L]
112+
RewriteRule "^examples/jupyter/flames/flame_speed_with_sensitivity_analysis.ipynb.html" "stable/examples/python/onedim/flamespeed_sensitivity.html" [R=permanent,L]
113+
RewriteRule "^examples/jupyter/flames/twin_premixed_flame_axisymmetric.ipynb.html" "stable/examples/python/onedim/premixed_counterflow_twin_flame.html" [R=permanent,L]
114+
RewriteRule "^examples/jupyter/input/ck2yaml_demo.ipynb.html" "stable/userguide/ck2yaml-tutorial.html" [R=permanent,L]
115+
116+
RewriteRule "^examples/jupyter/reactors/1D_packbed.ipynb.html" "stable/examples/python/reactors/1D_packed_bed.html" [R=permanent,L]
117+
RewriteRule "^examples/jupyter/reactors/1D_pfr_surfchem.ipynb.html" "stable/examples/python/reactors/1D_pfr_surfchem.html" [R=permanent,L]
118+
RewriteRule "^examples/jupyter/reactors/batch_reactor_ignition_delay_NTC.ipynb.html" "stable/examples/python/reactors/NonIdealShockTube.html" [R=permanent,L]
119+
RewriteRule "^examples/jupyter/reactors/interactive_path_diagram.ipynb.html" "stable/examples/python/kinetics/interactive_path_diagram.html" [R=permanent,L]
120+
RewriteRule "^examples/jupyter/reactors/nonideal_shock_tube.ipynb.html" "stable/examples/python/reactors/NonIdealShockTube.html" [R=permanent,L]
121+
RewriteRule "^examples/jupyter/reactors/stirred_reactor.ipynb.html" "stable/examples/python/reactors/continuous_reactor.html" [R=permanent,L]
122+
123+
RewriteRule "^examples/jupyter/thermo/equations_of_state.ipynb.html" "stable/examples/python/thermo/equations_of_state.html" [R=permanent,L]
124+
RewriteRule "^examples/jupyter/thermo/flame_temperature.ipynb.html" "stable/userguide/flame-temperature.html" [R=permanent,L]
125+
RewriteRule "^examples/jupyter/thermo/heating_value.ipynb.html" "stable/userguide/heating-value.html" [R=permanent,L]
126+
RewriteRule "^examples/jupyter.*" "stable/examples/python/index.html" [R=permanent,L]
127+
128+
# Someday, these MATLAB rules will be updated to point to a non-experimental version of the toolbox
129+
RewriteRule "^examples/matlab/surfreactor\.m\.html" "stable/examples/matlab_experimental/surf_reactor.html" [R,L]
130+
RewriteRule "^examples/matlab/diffflame\.m\.html" "stable/examples/matlab_experimental/diff_flame.html" [R,L]
131+
RewriteRule "^examples/matlab/Plug_Flow_Reactor\.m\.html" "stable/examples/matlab_experimental/plug_flow_reactor.html" [R,L]
132+
RewriteRule "^examples/matlab/index\.html" "stable/examples/matlab_experimental/index.html" [R,L]
133+
RewriteRule "^examples/matlab/(.+)\.m\.html" "stable/examples/matlab_experimental/$1.html" [R,L]
134+
135+
RewriteRule "^examples/cxx/LiC6-electrode.html" "stable/examples/cxx/LiC6_electrode.html" [R=permanent,L]
136+
RewriteRule "^examples/cxx/gas-transport.html" "stable/examples/cxx/gas_transport.html" [R=permanent,L]
137+
RewriteRule "^examples/cxx/openmp-ignition.html" "stable/examples/cxx/openmp_ignition.html" [R=permanent,L]
138+
RewriteRule "^examples/cxx/bvp.html" "stable/examples/cxx/blasius.html" [R=permanent,L]
139+
RewriteRule "^examples/cxx/jacobian.html" "stable/examples/cxx/derivative_speed.html" [R=permanent,L]
140+
RewriteRule "^examples/cxx/(.+)\.html" "stable/examples/cxx/$1.html" [R=permanent,L]
141+
RewriteRule "^examples/cxx/(.+)-(.+)\.html" "stable/examples/cxx/$1_$2.html" [R=permanent,L]
142+
143+
RewriteRule "^examples/fortran/demo.f.html" "stable/examples/fortran/f77_demo.html" [R=permanent,L]
144+
RewriteRule "^examples/fortran/index.html" "stable/examples/fortran/index.html" [R=permanent,L]
145+
RewriteRule "^examples/fortran/(\w+)\.(f|f90|cpp).html" "stable/examples/fortran/$1.html" [R=permanent,L]

mod_rewrite/2.4/.htaccess

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
RewriteBase "/2.4/"
2+
3+
RewriteRule "^sphinx/_static/(.+)" "sphinx/html/_static/$1" [R,L]

mod_rewrite/3.0/.htaccess

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
RewriteBase "/3.0/"
2+
3+
RewriteRule "^sphinx/html/python/(.+)" "sphinx/html/cython/$1" [R]

mod_rewrite/3.1/.htaccess

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
RewriteBase "/3.1/"
2+
3+
RewriteRule "^cython/(.+)" "python/$1" [R]
4+
RewriteRule "^cxx/d7/d32/classCantera_1_1Poly1(.*)" "cxx/d2/db3/classCantera_1_1Poly13$1" [L]
5+
RewriteRule "^cxx/dd/d77/classCantera_1_1ConnectorFactory(.*)" "cxx/d0/dc8/classCantera_1_1FlowDeviceFactory$1" [L]

mod_rewrite/dev/.htaccess

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
RewriteBase "/dev/"
2+
3+
RewriteRule "^cython/(.+)" "python/$1" [R]
4+
RewriteRule "^cxx/d2/db3/classCantera_1_1Poly13(.*)" "cxx/d7/d32/classCantera_1_1Poly1$1" [L]
5+
RewriteRule "^cxx/d0/dc8/classCantera_1_1FlowDeviceFactory(.*)" "cxx/dd/d77/classCantera_1_1ConnectorFactory$1" [L]

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ rebuild = { cmd = [
4242
"0",
4343
"--open-browser",
4444
] }
45+
add_htaccess = { cmd = "cp -r mod_rewrite/. build/html" }

0 commit comments

Comments
 (0)