Mobile app version of vmapp.org
Login or Join
Alves908

: Domain masking (and simple page links) How do you set up the domain (I'm using GoDaddy) to mask the server URL but to append the sub-page link. I'm thinking something like the Wikipedia en.wikipedia.org/wiki/something

@Alves908

Posted in: #Domains #Hyperlink

How do you set up the domain (I'm using GoDaddy) to mask the server URL but to append the sub-page link.

I'm thinking something like the Wikipedia en.wikipedia.org/wiki/something (or, if it would require httpd.conf access, setting it to append the default subpage link eg. ?page_id=2)

Currently I can set up the domain to either be masked completely without showing any sub-page links or to simply redirect my domain to my web server.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Alves908

1 Comments

Sorted by latest first Latest Oldest Best

 

@Reiling115

If I read correctly you want links to sub.domain.com/path to be redirected to domain.com/path and not just domain.com (may have the naked/sub domains the wrong way around but it's the same principle).

Generally this is called a relative redirect and can be done with an Apache rule like:

RewriteEngine on
RewriteRule ^http://sub.domain.com(/.*)$ domain.com [L,R]


You don't need the L option, it's just stops processing further rules in case something else conflicts, but you need the R (or R=302) to redirect to another domain. You may also want the redirects to be cacheable by setting long distance expiry dates, etc.

If you want the subdomain part to be the path you can use:

RewriteEngine on
RewriteRule ^http://(.*).domain.com(/.*)$ domain.com/ [L,R]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme