Last active
September 23, 2018 10:09
-
-
Save metelkin/ff5e0cb6ca11b438a7885f522834016a to your computer and use it in GitHub Desktop.
Examples of redirecting on apache server
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
### sudo a2ensite redirect.apache2.conf | |
### sudo service apache2 restart | |
### target may be http or https | |
### Permanent redirect user browser to http://target.example.com | |
<VirtualHost *:80> | |
ServerAdmin webmaster@localhost | |
ServerName source.example.com | |
ServerAlias source2.example.com | |
Redirect permanent "/" "http://target.example.com" | |
</VirtualHost> | |
### Temporal redirect user browser to http://target.example.com | |
<VirtualHost *:80> | |
ServerAdmin webmaster@localhost | |
ServerName source.example.com | |
ServerAlias source2.example.com | |
Redirect "/" "http://target.example.com" | |
</VirtualHost> | |
### redirect user browser to path | |
<VirtualHost *:80> | |
ServerAdmin webmaster@localhost | |
ServerName source.example.com | |
ServerAlias source2.example.com | |
RedirectMatch ^ "http://target.example.com/another/path" | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment