I want to add a DocC documentation to a specific path in my Next.js app (something like mydomain.com/documentation
) but I'm a bit at a loss.
There's a tutorial that tells you how to host the documentation on a server, but it uses a .htaccess
file as an example to set up all the needed redirects/rewrite conditions. Is there a way to translate this to next.js?
The documentation: https://developer.apple.com/documentation/Xcode/distributing-documentation-to-external-developers#Host-a-documentation-archive-on-your-website
To be specific, I need to somehow turn the following .htaccess
content into some kind of redirects managed by Next.js
:
# Enable custom routing.
RewriteEngine On
# Route documentation and tutorial pages.
RewriteRule ^(documentation|tutorials)\/.*$ SlothCreator.doccarchive/index.html [L]
# Route files and data for the documentation archive.
#
# If the file path doesn't exist in the website's root ...
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# ... route the request to that file path with the documentation archive.
RewriteRule .* SlothCreator.doccarchive/$0 [L]
I'd appreciate any help with this. I don't have much experience with Next.js