Skip to content

Commit

Permalink
Enhance version-based URL routing in .htaccess
Browse files Browse the repository at this point in the history
Updated .htaccess to support dynamic version-based routing for better scalability. Improved conditions to check for the presence of versioned index files and handle nested URL paths.
  • Loading branch information
ivangonzalezg committed Sep 15, 2024
1 parent 3c82ae1 commit cd64d70
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ RewriteBase /

RewriteRule ^$ /v1/ [L]

RewriteCond %{REQUEST_URI} ^/v2/?$ [NC]
RewriteRule ^v2/?$ /v2/index.html [L]
RewriteCond %{REQUEST_URI} ^/v([0-9]+)/?$ [NC]
RewriteCond %{DOCUMENT_ROOT}/v%1/index.html -f
RewriteRule ^v([0-9]+)/?$ /v%1/index.html [L]

RewriteRule ^v2/(.*)$ /v2/$1 [L]
RewriteRule ^v([0-9]+)/(.*)$ /v$1/$2 [L]

RewriteCond %{REQUEST_URI} !^/v1/
RewriteCond %{REQUEST_URI} !^/v2/
RewriteCond %{REQUEST_URI} !^/v[0-9]+/
RewriteCond %{REQUEST_URI} !^/v[0-9]+/(.*)$
RewriteRule ^(.*)$ /v1/$1 [L]

0 comments on commit cd64d70

Please sign in to comment.