Remove pages subdirectory from URL

fixup
This commit is contained in:
2022-01-18 08:31:13 +01:00
parent 242e4aadbd
commit f84fbc10f8
2 changed files with 8 additions and 0 deletions

View File

@@ -53,12 +53,19 @@ RewriteRule .* /krk/%1/ [R=301,QSD,L,nosubreq]
RewriteCond &%{QUERY_STRING}& &lang=cs&
RewriteRule .* /krk/ [R=301,QSD,L,nosubreq]
### Load files in pages/
RewriteCond %{REQUEST_URI} ^/krk/(.+)$
RewriteCond %{DOCUMENT_ROOT}/krk/pages/%1 -f
RewriteRule ^(.*)$ /krk/pages/$1 [END]
### Canonization
RewriteRule ^cs(?:/(.*))?$ /krk/$1 [R=301,L]
RewriteRule ^(en|de)$ /krk/$1/ [R=301,L]
RewriteRule ^(mainkrk|index|print).php$ /krk/ [R=301,L]
RewriteRule ^pages(/.*)$ /krk$1 [R=301,L,nosubreq]
### Fall back to loading pages through our “CMS”
RewriteCond %{REQUEST_URI} !^/pages/
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-d
RewriteRule ^(en|de)/$ /krk/index.php?lang=$1 [END]

View File

@@ -69,6 +69,7 @@ test_request '/krk/cs/mcr_2009/mcr_2009.html' 200 '/krk/mcr_2009/mcr_2009.html'
test_request '/krk/en/mcr_2009/mcr_2009.html'
test_request '/krk/clanky/beskydy-2010.html'
test_request '/krk/clanky/beskydy.html' 404
test_request '/krk/pages/mcr_2009/euro.gif' 200 '/krk/mcr_2009/euro.gif'
if test $failed = 0
echo "All tests passed" > /dev/stderr