Skip to content

Commit 99ef28c

Browse files
Said FathallaSaid Fathalla
authored andcommitted
fix recursive redirection loop in cdos and asmo #95
1 parent 0521d1f commit 99ef28c

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

asmo/.htaccess

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR]
3737
RewriteCond %{HTTP_ACCEPT} text/\* [OR]
3838
RewriteCond %{HTTP_ACCEPT} \*/\* [OR]
3939
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*
40-
RewriteRule ^(.*)$ https://ocdo.github.io/asmo/#$1 [R=303,NE,L]
40+
RewriteRule ^([^/]+)$ https://ocdo.github.io/asmo/#$1 [R=303,NE,L]
4141

4242
# Rewrite rule to serve RDF/XML content
4343
RewriteCond %{HTTP_ACCEPT} ^.*application/rdf\+xml.* [OR]

cdos/.htaccess

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ RewriteCond %{HTTP_ACCEPT} ^.*application/rdf\+xml.*
3333
RewriteRule ^cdco/v0.0.1$ https://raw.githubusercontent.com/OCDO/cdco/refs/heads/main/previous-versions/cdco_v001.owl [R=303,L]
3434
RewriteRule ^cdco/v0.0.1/$ https://raw.githubusercontent.com/OCDO/cdco/refs/heads/main/previous-versions/cdco_v001.owl [R=303,L]
3535

36-
# Rewrite rule to serve HTML content - terms
36+
# GENERAL TERM REDIRECTION (The "Safety Fix")
37+
# We use [^/]+ to ensure we only match a single term and stop the infinite loop
3738
RewriteCond %{HTTP_ACCEPT} !application/rdf\+xml.*(text/html|application/xhtml\+xml|text/\*|\*/\*)
3839
RewriteCond %{HTTP_ACCEPT} text/html [OR]
3940
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR]
4041
RewriteCond %{HTTP_ACCEPT} text/\* [OR]
4142
RewriteCond %{HTTP_ACCEPT} \*/\* [OR]
4243
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*
43-
RewriteRule ^cdco/(.*)$ https://ocdo.github.io/cdco/#$1 [R=303,NE,L]
44+
RewriteRule ^cdco/([^/]+)$ https://ocdo.github.io/cdco/#/$1 [R=303,NE,L]
4445

4546
# Rewrite rule to serve RDF/XML content
4647
RewriteCond %{HTTP_ACCEPT} ^.*application/rdf\+xml.* [OR]
@@ -67,7 +68,7 @@ RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR]
6768
RewriteCond %{HTTP_ACCEPT} text/\* [OR]
6869
RewriteCond %{HTTP_ACCEPT} \*/\* [OR]
6970
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*
70-
RewriteRule ^podo/(.*)$ https://ocdo.github.io/podo/#$1 [R=303,NE,L]
71+
RewriteRule ^podo/([^/]+)$ https://ocdo.github.io/podo/#$1 [R=303,NE,L]
7172

7273
# Rewrite rule to serve RDF/XML content
7374
RewriteCond %{HTTP_ACCEPT} ^.*application/rdf\+xml.* [OR]
@@ -94,7 +95,7 @@ RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR]
9495
RewriteCond %{HTTP_ACCEPT} text/\* [OR]
9596
RewriteCond %{HTTP_ACCEPT} \*/\* [OR]
9697
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*
97-
RewriteRule ^ldo/(.*)$ https://ocdo.github.io/ldo/#$1 [R=303,NE,L]
98+
RewriteRule ^ldo/([^/]+)$ https://ocdo.github.io/ldo/#$1 [R=303,NE,L]
9899

99100
# Rewrite rule to serve RDF/XML content
100101
RewriteCond %{HTTP_ACCEPT} ^.*application/rdf\+xml.* [OR]
@@ -132,7 +133,7 @@ RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR]
132133
RewriteCond %{HTTP_ACCEPT} text/\* [OR]
133134
RewriteCond %{HTTP_ACCEPT} \*/\* [OR]
134135
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*
135-
RewriteRule ^pldo/(.*)$ https://ocdo.github.io/pldo/#$1 [R=303,NE,L]
136+
RewriteRule ^pldo/([^/]+)$ https://ocdo.github.io/pldo/#$1 [R=303,NE,L]
136137

137138
# Rewrite rule to serve RDF/XML content
138139
RewriteCond %{HTTP_ACCEPT} ^.*application/rdf\+xml.* [OR]

0 commit comments

Comments
 (0)