Last active
August 30, 2017 15:26
-
-
Save BKeanu1989/6b69583f09dde95e52435120f4310d77 to your computer and use it in GitHub Desktop.
apache redirects
This file contains hidden or 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
SSL | |
www -> non-www | |
RewriteRule . /index.php [L] | |
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
RewriteRule ^(.*)$ https://%1/$1 [R=301,L] | |
----- use this | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
RewriteRule ^(.*)$ https://%1/$1 [R=301,L] | |
---- | |
----------------------------- | |
WP Only? | |
OLDDOMAIN -> NEWDOMAIN | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{HTTP_HOST} !.*YOURDOMAIN\.com$ [NC] | |
RewriteRule ^(.*)$ http://YOURDOMAIN.com/$1 [R=301,L] | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
------- | |
<VirtualHost *:80> | |
ServerName www.example.com | |
Redirect permanent / https://example.com/ | |
</VirtualHost> | |
<VirtualHost *:80> | |
ServerName example.com | |
# real server configuration | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment