# Redirect docs from the old to new location following the Great Docs Migration of 2017

redirectmatch 301 ^/python-openstackclient/([^/]+)/command-objects/([^/.]+).html$ /python-openstackclient/$1/cli/command-objects/$2.html

redirectmatch 301 ^/python-openstackclient/([^/]+)/(authentication|backward-incompatible|command-list|commands|decoder|interactive).html$ /python-openstackclient/$1/cli/$2.html
redirectmatch 301 ^/python-openstackclient/([^/]+)/plugin-commands.html$ /python-openstackclient/$1/cli/plugin-commands/index.html

redirectmatch 301 ^/python-openstackclient/([^/]+)/specs/([^/.]+).html$ /python-openstackclient/$1/contributor/specs/$2.html

redirectmatch 301 ^/python-openstackclient/([^/]+)/(command-(beta|errors|logs|options|wrappers)|developing|humaninterfaceguide|plugins).html$ /python-openstackclient/$1/contributor/$2.html
redirectmatch 301 ^/python-openstackclient/([^/]+)/cli/plugin-commands.html$ /python-openstackclient/$1/cli/plugin-commands/index.html
# For common subcommand names:
# - identity pages were split into -v2 and -v3
# - image pages were split into -v1 and -v2
# The unversioned page is hidden but contains links to the versioned pages so links in the wild redirect somewhere sane.
redirectmatch 301 ^/python-openstackclient/([^/]+)/cli/command-objects/(ec2-credentials|endpoint|image|project|role|service|token|user).html$ /python-openstackclient/$1/cli/_hidden/$2.html

# Redirect docs from their previous flat structure to the new service/version structure
redirectmatch 301 ^/python-openstackclient/([^/]+)/cli/command-objects/(availability-zone|command|complete|configuration|extension|limits|module|project-cleanup|quota|versions)\.html$ /python-openstackclient/$1/cli/command-objects/common/index.html
redirectmatch 301 ^/python-openstackclient/([^/]+)/cli/command-objects/(aggregate|compute-agent|compute-service|console-connection|console-log|console-url|flavor|host|hypervisor-stats|hypervisor|keypair|server-backup|server-event|server-group|server-image|server-migration|server|usage)\.html$ /python-openstackclient/$1/cli/command-objects/compute/v2/index.html
redirectmatch 301 ^/python-openstackclient/([^/]+)/cli/command-objects/(ec2-credentials-v2|endpoint-v2|project-v2|role-v2|service-v2|token-v2|user-v2)\.html$ /python-openstackclient/$1/cli/command-objects/identity/v2/index.html
redirectmatch 301 ^/python-openstackclient/([^/]+)/cli/command-objects/(access-rules|access-token|application-credentials|catalog|consumer|credential|domain|ec2-credentials-v3|endpoint-v3|endpoint_group|federation-domain-project|federation-protocol|group|identity-provider|implied_role|limit|mapping|policy|project-v3|region|registered-limit|request-token|role-assignment|role-v3|service-provider|service-v3|token-v3|trust|user-v3)\.html$ /python-openstackclient/$1/cli/command-objects/identity/v3/index.html
redirectmatch 301 ^/python-openstackclient/([^/]+)/cli/command-objects/(image-member|image-task|image-v2)\.html$ /python-openstackclient/$1/cli/command-objects/image/v2/index.html
redirectmatch 301 ^/python-openstackclient/([^/]+)/cli/command-objects/(address-group|address-scope|default-security-group-rule|floating-ip-port-forwarding|floating-ip|ip-availability|local-ip-association|local-ip|network-agent|network-auto-allocated-topology|network-flavor-profile|network-flavor|network-l3-conntrack-helper|network-meter-rule|network-meter|network-qos-policy|network-qos-rule-type|network-qos-rule|network-rbac|network-segment|network-service-provider|network-trunk|network|network_segment_range|port|router-ndp-proxy|router|security-group-rule|security-group|subnet-pool|subnet)\.html$ /python-openstackclient/$1/cli/command-objects/network/v2/index.html
redirectmatch 301 ^/python-openstackclient/([^/]+)/cli/command-objects/(container|object-store-account|object)\.html$ /python-openstackclient/$1/cli/command-objects/object-store/v1/index.html
redirectmatch 301 ^/python-openstackclient/([^/]+)/cli/command-objects/(block-storage-cleanup|block-storage-cluster|block-storage-log-level|block-storage-manage|block-storage-resource-filter|consistency-group-snapshot|consistency-group|volume-attachment|volume-backend|volume-backup|volume-group-snapshot|volume-group-type|volume-group|volume-host|volume-message|volume-qos|volume-service|volume-snapshot|volume-transfer-request|volume-type|volume)\.html$ /python-openstackclient/$1/cli/command-objects/volume/v3/index.html
