-1

I want to build a site where any link to my domain such as domain.com/fefeg or domain.com/rfggtg the (/xxxxx) part will be randomly generated, always redirects to another domain.

Basically, any link with my domain + /xxxxx or even /xxx/xxx, will forward to another domain of my choosing such as otherdomain.com/x/index.php or whatever.

Godaddy has a forwarding option but doesnt forward if there is more to the link other than the plain domain name

How can i make this on my plain server? Is there a simple one file script to be uploaded to server that does this?

1
  • 1
    This is a question for WebMaster, and you need to google .htaccess or the equivalent of your server setup. It sounds like a URL shortener
    – mplungjan
    Commented Aug 11, 2023 at 9:57

1 Answer 1

0

If you're using Apache web server yes as commenter already mentioned, you need to adjust the .htaccess file to something like this:

RewriteEngine On
RewriteRule ^(.*)$ http://otherdomain.com/ [R=302,L]

This should redirect for every url in the domain with a 302 temporary redirect http response to the client.

1
  • And could you tell me how to host it? Don’t know much about setting up sites. I do have a site on Linux with cpanel? I think it’s also Apache lol. Anyway so I set up my host and insert only one file the htaccess file right? Commented Aug 11, 2023 at 17:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.