Another question following on from this thread. The only remaining item that I can't solve is that there is a listing for an now non-existent folder '/team/', but if I add this into my .htaccess file, it breaks all other .htaccess entries for files in that folder, i.e.
redirect 301 /team/ /team.html
redirect 301 /team/joe_bloggs.htm /team.html
redirect 301 /team/joe_bloggs.html /team.html
redirect 301 /team/bill_smith.htm /team.html
redirect 301 /team/bill_smith.html /team.html
If I then attempt to visit /team/joe_bloggs.htm, it takes me to
/team.html/joe_bloggs.htm
If I can fix this, it may help me understand how to resolve my original question and reduce the huge listing of redirect pages in my .htaccess file, so any help gratefully received.
You need to change the order, and put "redirect 301 /team/ /team.html
" at the end.
It reads line to line and if it finds something fits, it replaces it.
Furthermore, I think you need to learn to add, ^ and $ characters. ^ means, the expression should begin, and $ means the expression should end.
So, ^/team/$
means, it should be exactly /team/ and it wont match /team/joe_bloggs.htm