apache - Redirecting root / home page to custom page screws up all other redirects in .htaccess -
i’ve merged 2 websites one. i’ve set .htaccess redirects pages on deactivated site (hkgolf.co.uk) redirect equivalent on other site (http://harriskalinka.com).
this have , in .htaccess on deactivated site:
redirect 301 / http://harriskalinka.com/ redirect 301 /work/ http://harriskalinka.com/work/ redirect 301 /projects_tag/academy/ http://harriskalinka.com/work/ redirect 301 /projects_tag/asia/ http://harriskalinka.com/work/
what like’d have visitors got old website’s home page redirected page on new site telling why have been redirected , other redirects work normal. did this:
redirect 301 / http://harriskalinka.com/home/hk-golf-redirect/ redirect 301 /work/ http://harriskalinka.com/work/ redirect 301 /projects_tag/academy/ http://harriskalinka.com/work/ redirect 301 /projects_tag/asia/ http://harriskalinka.com/work/
what happens if go old sites home page (hkgolf.co.uk/) redirected http://harriskalinka.com/home/hk-golf-redirect/ (what want)
the problem is if got hkgolf.co.uk/work/ sent http://harriskalinka.com/home/hk-golf-redirect/work/ instead of http://harriskalinka.com/work/
why happening?
rearrange rules keep generic rule (catch-all) @ last:
redirect 301 /work/ http://harriskalinka.com/work/ redirect 301 /projects_tag/academy/ http://harriskalinka.com/work/ redirect 301 /projects_tag/asia/ http://harriskalinka.com/work/ redirect 301 / http://harriskalinka.com/home/hk-golf-redirect/
alternatively can use redirectmatch
have regex capabilities:
redirectmatch 301 ^/work/?$ http://harriskalinka.com/work/ redirectmatch 301 ^/projects_tag/academy/?$ http://harriskalinka.com/work/ redirectmatch 301 ^/projects_tag/asia/?$ http://harriskalinka.com/work/ redirectmatch 301 ^/?$ http://harriskalinka.com/home/hk-golf-redirect/
Comments
Post a Comment