Hi, I have a lot of websites running on the same domain, e.g. http://domain.com/ http://domain.com/sites/blog http://domain.com/sites/shop http://domain.com/sites/project-X, project-Y, project-Z, etc. All websites run on the same system, allowing me to quickly create new subsites, and upgrade all sites at once, by simply upgrading the CMS for the primary website (http://domain.com/). I now need to be able to associate domains with several of these sites, e.g. http://some-very-cool-web-shop.com => http://domain.com/sites/shop What I need is a "real domain", not just a redirect. What are my options ? - Thanks in advance : ) Best regards Jimmy Thomsen
why is a redirect not an option? you can have a redirect but keep the url you want in the url bar, which will probably be the easiest solution.
Splitter: No, a redirect will not let you keep the original URL at the address bar. URL Rewriting would allow something like it, but not across domains. What I need is being able to "map" a folder from accout X to a domain on accout Y.
Most CMS's like WP will re-write the URL so if you have: "I now need to be able to associate domains with several of these sites, e.g. http://some-very-cool-web-shop.com => http://domain.com/sites/shop " You would need to change http://domain.com/sites/shop to http://some-very-cool-web-shop.com in wp_options siteurl value The redirect should work unless the app changes the default home.
Jemt: if mod_proxy is enabled, you should be able to do it with htaccess... i'll give an example in the next post (forum won't let me post the example because it thinks it contains links and i don't have enough posts... which is what you get for being a lurker
say you have: domain.top with your shops: domain.top/shop/one and domain.top/shop/two say that you are going to use example.org for shop one and foo.bar for shop two step 1: put all your domains in the same vhost (ie: servername domain.top, serveralias example.org, serveralias foo.bar) step 2: create the htaccess (next post *sigh*) step 3: done now, if someone goes to domain.top they stay there, if they go to domain.top/shop/one, they go to shop one, if they go to example.org/product they will end up on domain.top/shop/one/product BUT see example.org/product in the address bar, and same for foo.bar and shop 2. things to take into account: - your absolute/relative links have to be adapted for this scenario (using absolute links for foo.bar will end up changing the address bar, and using relative links is easy to break so pay attention) - you have to have mod_proxy enabled and all domains in one vhost - if the [L,NE,P] doesn't work, you might try [P,NC,QSA]
the htaccess; Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^(www\.)?example\.org$ [NC] RewriteRule ^ http://www.domain.top/shop/one%{REQUEST_URI} [L,NE,P] RewriteCond %{HTTP_HOST} ^(www\.)?foo\.bar$ [NC] RewriteRule ^ http://www.domain.top/shop/two%{REQUEST_URI} [L,NE,P] keep in mind there might be an error in it, i'm a bit rusty - but i should have been more accurate since it's a rewrite and not a redirect, so technically... yeah, redirects won't do what you want. but it is possible in htaccess. another approach might be php, making an index page and having that extract information to just require the right things?