Skip to content

Commit

Permalink
feature/website support for /latest/ and /absolute-latest/ redirection (
Browse files Browse the repository at this point in the history
  • Loading branch information
rclabo authored Sep 27, 2024
1 parent 627fccc commit c053719
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
42 changes: 42 additions & 0 deletions websites/site/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# -----------------------------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the ""License""); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an ""AS IS"" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# -----------------------------------------------------------------------------------


# The Lucene.NET site uses .htaccess to implement helpful URL redirection into the
# Lucene.NET API documentation.
#
# We use rewrite rules to enable the following:
# - /doc/latest/ redirects to the API docs corresponding to the latest
# officially released version of Lucene.NET.
# - /doc/absolute-latest/ redirects to the API docs for the absolute
# latest version, including pre-release versions.
#
# Using URLs that start with /doc/latest/ and /doc/absolute-latest/ from the
# main website content into the API documentation always points to the appropriate
# version, with [R=301] signaling permanent redirects and [L] preventing further
# rule processing.


RewriteEngine On

# Redirect /docs/latest/ to /docs/3.0.3/
RewriteRule ^docs/latest/(.*)$ /docs/3.0.3/$1 [R=301,L]

# Redirect /docs/absolute-latest/ to /docs/4.8.0-beta00016/
RewriteRule ^docs/absolute-latest/(.*)$ /docs/4.8.0-beta00016/$1 [R=301,L]
7 changes: 5 additions & 2 deletions websites/site/site.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -----------------------------------------------------------------------------------
# -----------------------------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
Expand Down Expand Up @@ -68,6 +68,9 @@ if ($Clean) {
Remove-Item (Join-Path -Path $SiteFolder "obj") -force -ErrorAction SilentlyContinue
}

# Copy the .htaccess file to the _site directory after cleaning
Copy-Item -Path (Join-Path -Path $SiteFolder ".htaccess") -Destination (Join-Path -Path $SiteFolder "_site\.htaccess") -Force

$DocFxJson = Join-Path -Path $SiteFolder "docfx.json"
$DocFxLog = Join-Path -Path $SiteFolder "obj\docfx.log"

Expand All @@ -82,4 +85,4 @@ if($?) {
Write-Host "starting website..."
& $DocFxExe $DocFxJson --serve --port $StagingPort
}
}
}

0 comments on commit c053719

Please sign in to comment.