Created
June 5, 2019 00:35
-
-
Save Andrew67/5e57d2779f48c0d4410f79b754f64463 to your computer and use it in GitHub Desktop.
Apache .htaccess redirection template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Redirection template | |
RewriteEngine On | |
# HTTP Status Codes | |
# 301 - Moved Permanently: search engines will consider (and if needed switch to) the destination URL | |
# 302 - Moved Temporarily: does not cause the above. Default when no code provided after the R flag | |
# Unconditionally redirect all paths to the target site | |
RewriteRule ^/?.* https://target.example.com/ [R=301,L] | |
# Redirect while preserving the path and query string | |
# e.g. https://source.example.com/page-name?param=1 becomes https://target.example.com/page-name?param=1 | |
# RewriteRule ^/?(.*) https://target.example.com/$1 [R=301,QSA,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment