I have domain.com and domain.org as aliases pointing to the same vhost. How can I use .htaccess to redirect all domain.com requests to domain.org?
Via . Make sure to replace olddomain.com with the parked domain name and newdomain.com with your website's domain name. This will redirect all visitors for all URLs on olddomain.com to the same URL on newdomain.com. For example http://olddomain.com/awesome-page will redirect to https://newdomain.com/awesome-page.
A 301 signals a permanent redirect from one URL to another, meaning all users that request an old URL will be automatically sent to a new URL. A 301 redirect passes all ranking power from the old URL to the new URL, and is most commonly used when a page has been permanently moved or removed from a website.
You could use mod_rewrite to do this.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^example\.org$
RewriteRule ^ http://example.org%{REQUEST_URI} [L,R=301]
This rule redirects every request that’s not addressed to example.org
to the very same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With