Sunday 27 May 2012 5:21:23 am - 3 replies
Can any rewrite guru's suggest the best way to include domain and sub-domain specific 301 rewrites without having to create a separate apache virtual?
Ideally I think the default version recommended by eZ should include a base domain 301 redirect to www.domain since its best SEO practice, even if commented out.
Can anyone share their expertise in this area?
Sunday 27 May 2012 6:06:52 am
Hi Brendan,
You can easily redirect subdomains with RewriteCond & RewriteRule, but it's not needed for eZ Publish unless your sub-domains are pointing to different applications or servers (in which case this could be handled at the DNS level).
What's your setup and what are you trying to achieve?
Cheers,
Geoff
Modified on Sunday 27 May 2012 6:08:11 am by Geoff Bentley
Sunday 27 May 2012 7:57:23 am
Quote from Geoff Bentley :You can easily redirect subdomains with RewriteCond & RewriteRule, but it's not needed for eZ Publish unless your sub-domains are pointing to different applications or servers (in which case this could be handled at the DNS level).
What's your setup and what are you trying to achieve?
Hi Geoff
A couple areas but all 301's
Naturally they should all retain the path. eg.
secure.myoldwebsite.com/friendly/url-path > secure.mywebsite.com/friendly/url-path
Are you able to provide some working examples for me
I'd like to be able to do all this in a single virtual conf which would be clean.
Modified on Sunday 27 May 2012 8:01:54 am by Brendan Pike
Sunday 27 May 2012 8:31:55 am
Quote from Brendan Pike :Quote from Geoff Bentley :You can easily redirect subdomains with RewriteCond & RewriteRule, but it's not needed for eZ Publish unless your sub-domains are pointing to different applications or servers (in which case this could be handled at the DNS level).
What's your setup and what are you trying to achieve?
Hi Geoff
A couple areas but all 301's
- mywebsite.com > www.mywebsite.com
This one should be default in eZ recommended virtuals I believe- myoldsite.com > www.mywebsite.com
- www.myoldsite.com > www.mywebsite.com
- secure.myoldwebsite.com > secure.mywebsite.com
Naturally they should all retain the path. eg.
secure.myoldwebsite.com/friendly/url-path > secure.mywebsite.com/friendly/url-pathAre you able to provide some working examples for me
I'd like to be able to do all this in a single virtual conf which would be clean.
Ok, so in your virtual conf you need:
ServerName mywebsite.com
ServerAlias www.mywebsite.com myoldsite.com www.myoldsite.com secure.myoldwebsite.com secure.mywebsite.com
Then for rewrites:
RewriteCond %{HTTP_HOST} ^(myoldsite|mywebsite)\.com$ [NC]
RewriteRule ^(.*) http://www.mywebsite.com$1 [R=301]
RewriteCond %{HTTP_HOST} ^(secure\.)myoldsite\.com$ [NC]
RewriteRule ^(.*) http://%1mywebsite.com$1 [R=301]
Something like that - you may need to adjust slightly.
Then in /settings/override/site.ini.append.php use MatchOrder=host;uri and HostUriMatchMapItems[] to map your host names to siteaccesses.
Hope that helps.
Geoff
You must be logged in to post messages in this topic!