Need to build an extremely simple one page/script site that redirects all possible links of one domain to another site

72 Views Asked by At

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

There are 1 best solutions below

1
Noel Bürgler On

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.