Applying multiple URLs to a Site

Currently we only apply a single URL to a Site and create another Site asset with a redirect as the Index, 404 and Archive pages which points to the real site.


Site - www.example.com

Site - example.com => redirects to Sit above



We had some advice a few years ago that applying both URLs to a single Site can cause performance issues. I can see how this may occur and everything that happens needs to have two URLs applied but it seems easier to have the URLs applied. If I am on www.example.com/page and change that to example.com/page then I get redirected to the home page of www.example.com which isn't exactly desirable. We are now on v4.6.1 as opposed to v3.something.whatever that we were on a few years back.



How does everyone else do this? Are there going to be any issues - performance or otherwise - if we now apply the second URL to our sites?

.htaccess url rewrite?

[quote]
.htaccess url rewrite?

[/quote]

Thanks, that's a good idea that I never thought of, but isn't really an option for us.



=Edit=



Out of curiosity, how would I go about adding the rewrite if I had say 4 URLs that I wanted applied to a single site so that each page works as a link? Without applying the 4 URLs to the Site asset of course.

Something like the following will redirect any url that is a ServerAlias within your web server's virtual host config to redirect to www.yourdomain.com


You can put this within /var/www/mysource_matrix/.htaccess


    
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} !www.yourdomain.com$ [NC]
    RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]