.htaccess snippets

Remove trailing slashes

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

Redirect old paths & ther children to one url

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^our-services/(.*)$ /what-we-do [R=301,NC,L]
RewriteRule ^clients/(.*)$ /what-we-do [R=301,NC,L]
RewriteRule ^portfolio/(.*)$ /projects [R=301,NC,L]
RewriteRule ^company/(.*)$ /who-we-are [R=301,NC,L]
RewriteRule ^project/(.*)$ /projects [R=301,NC,L]

rewrite to primary domain

RewriteCond %{HTTP_HOST} !^mycoolwebsite.com$ [NC]
RewriteRule ^(.*)$ https://mycoolwebsite.com/$1 [L,R=301]

rewrite to https and non-www

RewriteCond %{HTTP_HOST} ^www\.mycoolwebsite\.com [NC]
RewriteRule ^(.*)$ https://mycoolwebsite.com/$1 [L,R=301]
Home |

Build with Gatsby |

Blog |Tolka Theme