Can someone please explain why this simple 301 REDIRECT is creating a loop of the final directory name.
I’ve just finished altering a website where some url’s have changed slightly.
So I’ve created 301 redirects to the contents new location.
I am using a caching plugin and WordPress. I have re-cached the site and cleared all the cache in my browser too, but I’m still getting the same error on one domain url, which I’ve confirmed is a problem using;
https://wheregoes.com
At the bottom of my .htaccess file (below) you will see my Custom 301 redirects to all the newly formatted content.
All are working fine except;
Redirect 301 /tonbridge /tonbridge/nursery
For some reason this is creating a loop where the url spits out;
https://www.juniorsdaynursery.co.uk/tonbridge/nursery/nursery/nursery/nursery/nursery/nursery/nursery/nursery/
recurring until it crashes due to too many re-directs.
If I remove this specific 301 Redirect everything works perfectly, but then I don’t have a redirection in place for previous visitors who have the old url;
https://www.juniorsdaynursery/tonbridge
and then of course the 404 page gets returned.
Any ideas why this 301 wouldn’t work as expected?
# BEGIN WpFastestCache
# Modified Time: 19-07-22 19:37:14
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^www.juniorsdaynursery.co.uk
# Start WPFC Exclude
# End WPFC Exclude
# Start_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^=]+=DanGoldsmith|TanyaGoldsmith
# End_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP_HOST} ^www.juniorsdaynursery.co.uk
RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WP_FASTEST_CACHE_CSS_VALIDATOR|Twitterbot|LinkedInBot|WhatsApp|Mediatoolkitbot)
RewriteCond %{HTTP_USER_AGENT} !(WPsFastestsCachesPreload(siPhonesMobile)?s*Bot)
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{REQUEST_URI} !(/){2}$
RewriteCond %{REQUEST_URI} /$
RewriteCond %{QUERY_STRING} !.+
RewriteCond %{HTTP:Cookie} !wordpress_logged_in
RewriteCond %{HTTP:Cookie} !comment_author_
RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil
RewriteCond %{HTTP:Profile} !^[a-z0-9"]+ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or]
RewriteCond /home/cf3cclcs/juniorsdaynursery.co.uk/wp-content/cache/all/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L]
</IfModule>
<FilesMatch "index.(html|htm)$">
AddDefaultCharset UTF-8
<ifModule mod_headers.c>
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT"
</ifModule>
</FilesMatch>
# END WpFastestCache
# BEGIN GzipWpFastestCache
<IfModule mod_deflate.c>
AddType x-font/woff .woff
AddType x-font/ttf .ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE x-font/ttf
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf
</IfModule>
# END GzipWpFastestCache
# BEGIN LBCWpFastestCache
<FilesMatch ".(webm|ogg|mp4|ico|pdf|flv|avif|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|otf|ttf|svg|eot)(.gz)?$">
<IfModule mod_expires.c>
AddType application/font-woff2 .woff2
AddType application/x-font-opentype .otf
ExpiresActive On
ExpiresDefault A0
ExpiresByType video/webm A10368000
ExpiresByType video/ogg A10368000
ExpiresByType video/mp4 A10368000
ExpiresByType image/avif A10368000
ExpiresByType image/webp A10368000
ExpiresByType image/gif A10368000
ExpiresByType image/png A10368000
ExpiresByType image/jpg A10368000
ExpiresByType image/jpeg A10368000
ExpiresByType image/ico A10368000
ExpiresByType image/svg+xml A10368000
ExpiresByType text/css A10368000
ExpiresByType text/javascript A10368000
ExpiresByType application/javascript A10368000
ExpiresByType application/x-javascript A10368000
ExpiresByType application/font-woff2 A10368000
ExpiresByType application/x-font-opentype A10368000
ExpiresByType application/x-font-truetype A10368000
</IfModule>
<IfModule mod_headers.c>
Header set Expires "max-age=A10368000, public"
Header unset ETag
Header set Connection keep-alive
FileETag None
</IfModule>
</FilesMatch>
# END LBCWpFastestCache
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# Custom Redirects
Redirect 301 /tonbridge /tonbridge/nursery
Redirect 301 /tonbridge-teenies /tonbridge/teenies
Redirect 301 /tonbridge-toddlers /tonbridge/toddlers
Redirect 301 /tonbridge-preschool /tonbridge/preschool
Redirect 301 /tonbridge-pricing /tonbridge/pricing
Redirect 301 /tonbridge-gallery /tonbridge/gallery
Redirect 301 /tonbridge-policies /tonbridge/policies
Redirect 301 /cranbrook-teenies /cranbrook/teenies
Redirect 301 /cranbrook-toddlers /cranbrook/toddlers
Redirect 301 /cranbrook-preschool /cranbrook/preschool
Redirect 301 /cranbrook-pricing /cranbrook/pricing
Redirect 301 /cranbrook-gallery /cranbrook/gallery
Redirect 301 /cranbrook-policies /cranbrook/policies
Redirect 301 /tunbridge-wells-teenies /tunbridge-wells/teenies
Redirect 301 /tunbridge-wells-toddlers /tunbridge-wells/toddlers
Redirect 301 /tunbridge-wells-preschool /tunbridge-wells/preschool
Redirect 301 /tunbridge-wells-pricing /tunbridge-wells/pricing
Redirect 301 /tunbridge-wells-gallery /tunbridge-wells/gallery
Redirect 301 /tunbridge-wells-policies /tunbridge-wells/policies
Redirect 301 /boughton-monchelsea-teenies /boughton-monchelsea/teenies
Redirect 301 /boughton-monchelsea-toddlers /boughton-monchelsea/toddlers
Redirect 301 /boughton-monchelsea-preschool /boughton-monchelsea/preschool
Redirect 301 /boughton-monchelsea-pricing /boughton-monchelsea/pricing
Redirect 301 /boughton-monchelsea-gallery /boughton-monchelsea/gallery
Redirect 301 /boughton-monchelsea-policies /boughton-monchelsea/policies
Redirect 301 /headcorn /boughton-monchelsea/nursery
Redirect 301 /headcorn-teenies /boughton-monchelsea/teenies
Redirect 301 /headcorn-toddlers /boughton-monchelsea/toddlers
Redirect 301 /headcorn-preschool /boughton-monchelsea/preschool
Redirect 301 /headcorn-pricing /boughton-monchelsea/pricing
Redirect 301 /headcorn-gallery /boughton-monchelsea/gallery
Redirect 301 /headcorn-policies /boughton-monchelsea/policies