.htaccess - Avoid Too Many Redirects on Root level 301 -


i'm attempting change .htaccess on website such each page redirects specific page on website. i've managed non-root level pages redirect new domain no problem, seem try redirect root of old website end getting 'too many redirects' problem. feels pretty key optimizing someone's site when they've changed previous domain, useful know.

the code i've got working this:

redirect 301 /my_counselling.html newsite.org.uk/ redirect 301 /fees_and_contacts.html newsite.org.uk//?page_id=11 redirect 301 /qualifications.html newsite.org.uk/ redirect 301 /resources.html newsite.org.uk/ redirect 301 /abuse.html newsite.org.uk/ redirect 301 /drug_and_alchol.html newsite.org.uk//?page_id=57 redirect 301 /lgbt_sexuality.html newsite.org.uk//?page_id=13 redirect 301 /dyslexia.html newsite.org.uk//?page_id=8 

but following attempts match root level fail:

redirect 301 / newsite.org.uk/ 

or

rewriterule oldsite.com/ newsite.org.uk [r=301,l,nc] 

or

redirectmatch 301 ^/ newsite.org.uk/ 

which suggestions i've read.

this feels should simple. if can visitors , bots have gone old site's root go new site's root i'll done.

thanks much!

it looks both domains on same server, in case, you'll need match against olddomain using rewritecondition , redirect newdomain if condtion true.

rewriteengine on rewritecond %{http_host} ^(www\.)?olddomain.uk$ rewriterule ^(.*)$ http://www.newdomain.uk/$1 [nc,l,r=301] 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -