Skip to content

Instantly share code, notes, and snippets.

@S-n-d
Last active January 25, 2023 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save S-n-d/0b922eae281423f2ad463c9a28d4bfe4 to your computer and use it in GitHub Desktop.
Save S-n-d/0b922eae281423f2ad463c9a28d4bfe4 to your computer and use it in GitHub Desktop.
[htaccess] #htaccess
# force https + www to non-www
RewriteEngine on
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
# redirect olddomain.be to newdomain.be
RewriteEngine on
RewriteCond %{HTTP_HOST} ^olddomain.be$ [OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.be$
RewriteRule (.*)$ https://newdomain.be/$1 [R=301,L]
# redirect deleted languages to new
RewriteEngine On
RewriteRule ^en-uk/(.*)$ /$1 [R=301,NC,L,QSA]
RewriteRule ^nl-be/(.*)$ /nl/$1 [R=301,NC,L,QSA]
RewriteRule ^fr-be/(.*)$ /fr/$1 [R=301,NC,L,QSA]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment