redirect from a subdomain to the main domain

/ Published in: Apache
Save to your folder(s)

Needed to retire a staging domain, so I'm redirected all traffic to the equivalent page in the root directory in the .htaccess file

Copy this code and paste it in your HTML
  1. RewriteEngine On
  2. RewriteBase /
  3. RewriteCond %{HTTP_HOST} ^staging.example\.com$ [NC]<br />RewriteRule ^(.*)$$1 [L,R=301]

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.