Search code examples
wordpress.htaccesssubdomainmultisite

Mask a url to use a subdomain url


On a WordPress multisite, I need an HTML file to be shown as if it is in a subdomain that doesn't exist in reality but does on the multisite. I've tried quite a few htaccess variations to no avail.

mydomain.example/myfile.html 

should be shown with a url of

mysub.mydomain.example/myfile.html

Since I can not have the file in a place that does not exist I just want the URL masked as being in the subdomain while the file is in its same location.

Any advice or solutions while I continue my research would be appreciated.


Solution

  • Just put the file there, and reference it with whatever subdomain you want. If you have wildcard DNS setup properly, which you should if you have a Subdomain Multisite set up, it will work just fine.

    You can see it working here:

    http://doesntexist.thirdriverlocalsearch.com/1000x160.png

    http://fakeurl.thirdriverlocalsearch.com/1000x160.png

    http://thirdriverlocalsearch.com/1000x160.png

    That image just exists in the /public_html/ directory, and those subdomains (of course) are fake and haven't actually been set up.