Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sirexzib's avatar

How would I allow two domains for my project? One regular and one short as a shortcut

Hi, Say I have the domain: www.mydomain.com And users can go to their profiles using www.mydomain.com/user/username

Now I recently got a short version of my domain called www.myd.com I would like it so you can do www.myd.com/username and it would take you to www.mydomain.com/user/username

How would you do that?

Do I need to do anything server sided or is this possible to do with DNS?

I am using laravel forge and digital ocean for my website.

0 likes
5 replies
Snapey's avatar

You need a forwarder. Sometimes your domain registrar will bundle this, or of you are running apache you can create a redirect in your vhosts file.

sirexzib's avatar

@Snapey Well I did setup a forwarded but that doesn't let you forward to a url with a username parameter.

for example *.myd.com can only redirect to one mydomain.com/user/NOPARAMETERHERE.

So that isn't really possible.

Cronix's avatar

Make sure you send a 301 redirect, or you will get penalized in google and other search engines for having duplicate content.

sirexzib's avatar

@Cronix Oh, so it's not as simple as setting the short domain as a A record to the server and then do some laravel work to redirect it to the correct url? Even if masked?

I did this:

http://i.imgur.com/LIes15O.png

I'm waiting for DNS to update to see if it works, not sure however. I also added the short domain to the nginx config.

Please or to participate in this conversation.