I am administering a website that previously had mini-sites set up for various physical locations using sub-domains (city1.site.com
, town2.site.com
, etc.) and I now need to disable these mini-sites. They are no longer being used and reside on a server that is obsolete. However I want the users that may have or find old links to be directed to the Magento store running on a new server with a request that looks like www.site.com/store-locations-city1
so that the user gets that store's information page.
If I simply change the DNS entries for those subdomains to point to the web store server, and there is no virtual host configuration, they will be redirected (I believe, haven't tested) to the default virtual host. (i.e. city1.site.com
directed to www.site.com
's IP with no virtual host for city1
will be redirected to www.site.com
)
If that is correct, can I simply set up a rewrite rule for each subdomain that reqrites the URL to www.site.com/store-location-[city/town]
? Where would I configure those rewrites?
If this doesn't work the way I think it does, what alternative do I have?
Upon further reading, I tested with one site and these are my results: without a virtual host, I can verify that the url is automatically redirected to the default virtual host.
If the url originall contained anything it doesn't change this behavior.
I added a virtual host for that subdomain with:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName city.site.com
ServerAlias www.site.com city.site.com
Redirect / http://www.site.com/store-locations-city
</VirtualHost>
which works unless the original URL had something else in it, say city1.site.com/contact
which results in a 404 because www.site.com/store-locations-city1contact
doesn't exist.
I still need to know how and where to rewrite anything other than /
in this case