apache - .htaccess multi-domain redirect to respective domain's page -
we have updated our multi-domain website, hence many of our old urls defunct , planning redirect them each respective domain.
our current server's vhost configuration such
<virtualhost *:80> serveradmin user@domain.com documentroot "/var/www/vhosts/project/httpdocs" servername domain.uk serveralias www.domain.uk domain.de www.domain.de domain.fr www.domain.fr errorlog "/var/www/vhosts/project/logs/error.log" customlog "/var/www/vhosts/project/logs/access.log" combined <directory "/var/www/vhosts/project/httpdocs"> allowoverride order allow,deny allow </directory> </virtualhost>
so domains points same folder on server , hence share same .htaccess file well.
we have next old urls need redirected respective domains, please shed lite on how can done.
http://www.domain.uk/default1 -> http://www.domain.uk/def1 http://www.domain.uk/default2 -> http://www.domain.uk/def2 http://www.domain.uk/default3 -> http://www.domain.uk/def3 http://www.domain.de/default1 -> http://www.domain.de/def1i tried next doesn't work properly
rewriterule ^default1$ http://www.domain.uk/def1 [r=301,nc,ne,l]
required 1. redirect http://www.domain.uk , http://www.domain.de, not http://www.domain.fr
you can utilize generic rule in root .htaccess:
rewriteengine on rewritecond %{http_host} \.fr$ [nc] rewriterule ^/?(def)ault(1)/?$ http://%{http_host}/$1$2 [r=301,nc,ne,l]
apache .htaccess mod-rewrite redirect
No comments:
Post a Comment