I have a onion domain private key and registered a clearnet website hosting on namecheap.com
Now I want to make the onion domain work like alias to the clearnet url like the Alias DNS record.
How can I do that?
onion names are not based on DNS and don't work like them, but there are things that you can do.
Here is how I would do it. Just FYI, my example is based on Linux.
My website is simple. It is a simple http based site running on port 80. I enable and start apache on port 80 on my web server. I go to my cleanet dns provider and create an A record to point to my web server. mywebsite.com is now alive and I can reach it through the clearnet.
Next I install Tor on the web server. I edit /etc/tor/torrc to allow traffic on 80:
HiddenServicePort 80 127.0.0.1:80
After starting the Tor service, I have a new file, "/var/lib/tor/hidden_service/hostname" with my new onion service.
I open Tor Browser and I first go to mywebsite.com and it still works. Then I go to mywebsiteabcxyz.onion and it also works.
This is the easy way to do what you are asking.
Here's there difficult part. What if you want more? What if you want https on your clearnet and onion service? What if you want a clustered server? What if you are using a load balancer? What if you want to work with vhosts? These things aren't documented well yet and they may take trial and error to get working.