Skip to content

Instantly share code, notes, and snippets.

@nextab
Created December 28, 2023 18:23
Show Gist options
  • Save nextab/7addf644deb69681d03ec72554ea4ffa to your computer and use it in GitHub Desktop.
Save nextab/7addf644deb69681d03ec72554ea4ffa to your computer and use it in GitHub Desktop.
# Standard Input Variables for the Divi Theme
php_value max_execution_time 240
php_value max_input_time 90
php_value max_input_vars 3000
php_value memory_limit 512M
# Redirect everything (no matter whether it's non-https or with www.) to https://yourdomain.com
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Redirect http to https (but NOT www to non-www)
RewriteEngine on
# force ssl
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
# Redirect from NON-www to https://www.yourdomain.com (replace nextab.de)
RewriteEngine on RewriteCond %{HTTP_HOST} nextab.de [NC]
RewriteRule ^(.*)$ https://www.nextab.de/$1 [L,R=301,NC]
# Redirect from Domain a (in this case mitplanzumerfolg.de) to Domain b (alinawelfonder.com) via .htaccess and KEEP the deeplinks (so someone accessing mitplanzumerfolg.de/kein-plan will end up on alinawelfonder.com/kein-plan)
RewriteEngine On
RewriteCond %{HTTP_HOST} ^ mitplanzumerfolg\.de$
RewriteRule ^(.)$ http://www.alinawelfonder.com/$1 [R=301,L]*
# Dynamically replace parts of the URL, e.g. https://url.com/LISTING/abc to https://url.com/COMPANY/abc
RedirectMatch 301 ^/listing/(.*)$ /company/$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment