How can I set up an Addon Domain and Redirect to the Main Domain?

I have 2 domains, a .net and .org domain and I’ve made my main site domain using the .net domain and I would like to add the .org domain and redirect it completely (web browser) to the main domain.

I’ve added the 2nd domain using “Add Domains” in my CyberPanel. Then within the File Manager, I’ve created an .htaccess file in the folder of the Addon Domain and included the following code to redirect the .org domain to the .net domain.

This is an example of what I have right now:

Path: /home/DOMAIN.net/public_html/DOMAIN.org

Code added to the .htaccess file:

`RewriteEngine on
RewriteRule ^(.*)$ https://domain.net/$1 [R=301,L]`
```


It's not working. What am I doing wrong? What do I need to do to make this work? I rather not do Domain Alias because I want the .org domain to automatically redirect to .net domain. I don't want duplicate content, and I don't want my site to show content on both domains simultaneously, either or. 

I have another website on a different host that uses cPanel and there is an Addon Domain feature which I've used successfully to create an addon domain. I'm also using the same coding above to redirect the .org to the .net (main site domain). It works like it should.

I'd appreciate the help and information on how to make this work. This is only my 2nd day using a panel like CyberPanel. I'm still learning. :smile:

OpenLiteSpeed does not read rules if you create them from File Manager. You need to use Child Domain Launcher to save rewrite rules for child domains: https://docs.cyberpanel.net/doku.php?id=child-domains-launcher

Open Launcher for your child domain and scroll down to Find Rewrite Rules

And correct rewrite rule is:

RewriteEngine on
RewriteRule ^/(.*)$ https://domain.net/$1 [R=301,L]

I applied your rule, but…

It “ates” the last trailing slash, so if child domain is “childdomain.com” and someone tries “childdomain.com/blog/

The result will be: https://domain.netblog which of course doesn’t exist.

OpenLitespeed will read files from filemanager as long as you remember to restart litespeed after you save it. This is what you should put in your (.org) .htaccess file.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^youdomain.org$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.yourdomain.org$ [NC]
RewriteRule ^(.*)$ https://www.otherdomain.net/$1 [L,R=301,NC]

Remember you should be able to forward your .org domain (301) from the registrar. That w2ay you won’t need an addon domain on your server.