2

I'm having trouble working out how to do a 301 redirect from:

https://www.example.com/catalogue/catalogue.php?catSection=1

to

https://www.example.com/hire-category/access-support-equipment/

I've tried a few things including from this thread: Remove query string from 301 redirect URL

RewriteCond %{QUERY_STRING} =catSection=1
RewriteRule ^catalogue/catalogue.php$ /hire-category/access-support-equipment/ [QSD,R=301,L]

But that isn't working for me.


Full .htaccess as it stands at the moment:

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php74” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

# 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
RewriteEngine On
# Top Level Pages
redirect 301 /about.php     https://www.example.com/about/
redirect 301 /quality.php   https://www.example.com/quality-of-service/
redirect 301 /history.php   https://www.example.com/history-of-didcot-plant/
redirect 301 /sales.php     https://www.example.com/
redirect 301 /health-safety.php https://www.example.com/health-safety/
redirect 301 /hav.php   https://www.example.com/hand-arm-vibration-in-the-workplace/
redirect 301 /hav-equipment.php https://www.example.com/hand-arm-vibration-emission-values/
redirect 301 /contact.php   https://www.example.com/contact/
redirect 301 /accountapplication/   https://www.example.com/account-application/
redirect 301 /accountapplication/credit-account.php https://www.example.com/apply-for-credit-account/
redirect 301 /accountapplication/cash-account.php   https://www.example.com/apply-cash-account/
redirect 301 /covid-operatingconditions.php     https://www.example.com/covid-19-operating-conditions/
redirect 301 /terms.php https://www.example.com/terms-conditions/
redirect 301 /privacy.php   https://www.example.com/privacy/
redirect 301 /sitemap.php   https://www.example.com/
redirect 301 /directions.php    https://www.example.com/directions/
redirect 301 /testimonials.php  https://www.example.com/testimonials/

# Catalogue
redirect 301 /catalogue/    https://www.example.com/hire-catalogue/?

# News
redirect 301 /news/2021/04/extra-hydraulic-rotavators-arrive/   https://www.example.com/extra-hydraulic-rotavators-arrive/
redirect 301 /news/2021/04/new-stump-grinder/   https://www.example.com/new-stump-grinder/
redirect 301 /news/2021/03/new-dumpers-added-to-fleet/  https://www.example.com/new-dumpers-added-to-fleet/
redirect 301 /news/2021/02/another-turf-cutter-added-to-fleet/  https://www.example.com/another-turf-cutter-added-to-fleet/
redirect 301 /news/2021/01/spring-preparations-begin/   https://www.example.com/spring-preparations-begin/
redirect 301 /news/2020/11/new-stihl-disc-cutters/  https://www.example.com/new-stihl-disc-cutters/
redirect 301 /news/2020/11/new-mini-dumper/ https://www.example.com/new-mini-dumper/
redirect 301 /news/2020/11/new-heaters-arrive/  https://www.example.com/new-heaters-arrive/
redirect 301 /news/2020/10/new-paslode-nailers-added-to-fleet/  https://www.example.com/new-paslode-nailers-added-to-fleet/
redirect 301 /news/2020/09/extra-milwaukee-900k-breakers-purchased/ https://www.example.com/extra-milwaukee-900k-breakers-purchased/
redirect 301 /news/2020/06/changing-excavator-buckets/  https://www.example.com/changing-excavator-buckets/
redirect 301 /news/2020/06/how-to-start-a-honda-engine/ https://www.example.com/how-to-start-a-honda-engine/
redirect 301 /news/2020/06/how-to-build-a-concrete-base-for-a-garden-shed/  https://www.example.com/how-to-build-a-concrete-base-for-a-garden-shed/
redirect 301 /news/2020/05/new-k008-added-to-fleet/ https://www.example.com/new-k008-added-to-fleet/
redirect 301 /news/2020/02/new-kubota-3-0t-digger/  https://www.example.com/new-3-0t-digger/
redirect 301 /news/2020/01/stihl-ts410-disc-cutters/    https://www.example.com/stihl-ts410-disc-cutters/
redirect 301 /news/2019/11/new-kubota-model-joins-fleet/    https://www.example.com/new-kubota-model-joins-fleet/
redirect 301 /news/2019/08/further-investment-new-floor-sanders/    https://www.example.com/further-investment-new-floor-sanders/
redirect 301 /news/2019/07/new-kubota-kx057-4-joins-hire-fleet/ https://www.example.com/new-kubota-kx057-4-joins-hire-fleet/
redirect 301 /news/2019/05/new-lorry-on-the-road/   https://www.example.com/new-lorry-on-the-road/
redirect 301 /news/2019/04/trio-of-genies/  https://www.example.com/trio-of-genies/
redirect 301 /news/2019/03/three-new-hinowa-mini-dumpers/   https://www.example.com/three-new-hinowa-mini-dumpers/
redirect 301 /news/2019/03/green-seat-belt-beacons-fully-available/ https://www.example.com/green-seat-belt-beacons-fully-available/
redirect 301 /news/2019/02/two-manitou-telehandlers-arrive/ https://www.example.com/two-manitou-telehandlers-arrive/
redirect 301 /news/2019/02/new-kubota-3t-excavators/    https://www.example.com/new-kubota-3t-excavators/
redirect 301 /news/2019/01/new-bomag-120ad-5-arrives/   https://www.example.com/new-bomag-120ad-5-arrives/
redirect 301 /news/2019/01/petrol-pump-fleet-overhauled/    https://www.example.com/petrol-pump-fleet-overhauled/
redirect 301 /news/2018/12/new-portable-masonry-saws/   https://www.example.com/new-portable-masonry-saws/
redirect 301 /news/2018/06/big-investment-in-hire-fleet-in-2018/    https://www.example.com/big-investment-in-hire-fleet/
redirect 301 /news/2018/01/kubotas-new-kx030-4-excavator-arrives/   https://www.example.com/kubotas-new-kx030-4-excavator-arrives/
redirect 301 /news/2018/01/re-handling-bucket-telehandler/  https://www.example.com/re-handling-bucket-for-telehandler/
redirect 301 /news/2017/11/indirect-heaters-join-range/ https://www.example.com/indirect-heaters-join-our-range/
redirect 301 /news/2017/09/volvo-excavators-double-addition/    https://www.example.com/volvo-excavators-double-addition/
redirect 301 /news/2017/08/two-new-6t-dumpers/  https://www.example.com/two-new-6t-dumpers/
redirect 301 /news/2017/08/telehandlers-at-the-double/  https://www.example.com/telehandlers-at-the-double/
redirect 301 /news/2017/07/new-hi-tip-barrow/   https://www.example.com/new-hi-tip-barrow/
redirect 301 /news/2017/07/two-more-diggers/    https://www.example.com/two-more-diggers/
redirect 301 /news/2017/05/new-bomag-120ad-5-roller/    https://www.example.com/new-bomag-120ad-5-roller/
redirect 301 /news/2017/04/peckers-pack-punch/  https://www.example.com/these-peckers-pack-a-punch/
redirect 301 /news/2017/02/new-swivel-dumpers-purchased/    https://www.example.com/new-swivel-dumpers-purchased/
redirect 301 /news/2016/12/telehandlers-added-range/    https://www.example.com/telehandlers-added-to-range/
redirect 301 /news/2016/11/winter-christmas-opening-times-20162017/ https://www.example.com/winter-and-christmas-opening-times-2016-2017/
redirect 301 /news/2016/10/new-bomag-roller/    https://www.example.com/new-bomag-roller/
redirect 301 /news/2016/10/another-kx015-4/ https://www.example.com/another-kx015-4/
redirect 301 /news/2016/10/new-hilux-van/   https://www.example.com/new-hilux-van/
redirect 301 /news/2016/09/new-plant-trailer-2/ https://www.example.com/new-plant-trailer/
redirect 301 /news/2016/09/new-hi-tip-dumper/   https://www.example.com/new-hi-tip-dumper/
redirect 301 /news/2016/07/trio-of-dumpers/ https://www.example.com/trio-of-dumpers/
redirect 301 /news/2015/09/new-jcb-beaver-iii-powerpacks/   https://www.example.com/new-jcb-beaver-iii-powerpacks/
redirect 301 /news/2015/09/two-new-kubotas-arrive/  https://www.example.com/two-new-kubotas-arrive/
redirect 301 /news/2015/02/nine-new-kubotas/    https://www.example.com/nine-new-kubotas/
redirect 301 /news/2014/09/two-new-volvo-9-tonne-diggers-added-fleet/   https://www.example.com/two-new-volvo-9tonne-diggers-added-to-fleet/
redirect 301 /news/2014/09/new-6-tonne-dumper-purchased/    https://www.example.com/new-6tonne-dumper-purchased/
redirect 301 /news/2014/05/new-plant-trailer/   https://www.example.com/new-plant-trailer-2/
redirect 301 /news/2014/04/5-tonne-digger-fleet-grows/  https://www.example.com/5tonne-digger-fleet-grows/
redirect 301 /news/2014/03/new-stump-grinder-purchased/ https://www.example.com/new-stump-grinder-purchased/
redirect 301 /news/2013/07/mobile-website-launched/ https://www.example.com/mobile-website-launched/
redirect 301 /news/2013/07/new-roller/  https://www.example.com/new-roller/
redirect 301 /news/2013/05/new-digger-and-dumper-join-fleet/    https://www.example.com/new-digger-and-dumper-join-fleet/
redirect 301 /news/2012/12/5-tonne-excavator-fleet-increased/   https://www.example.com/5-tonne-excavator-fleet-increased/
redirect 301 /news/2012/11/new-skip-loading-power-barrows/  https://www.example.com/new-skip-loading-power-barrows/
redirect 301 /news/2012/07/new-weldergenerator/ https://www.example.com/new-welder-generator/
redirect 301 /news/2012/07/new-compound-saw-a-cut-above/    https://www.example.com/new-compound-saw-a-cut-above/
redirect 301 /news/2012/07/two-new-hot-cold-pressure-washers/   https://www.example.com/two-new-hot-cold-pressure-washers/
redirect 301 /news/2012/04/new-box-van-trailer/ https://www.example.com/new-box-van-trailer/
redirect 301 /news/2012/04/new-swivel-dumpers-join-our-range/   https://www.example.com/new-swivel-dumpers-join-our-range/
redirect 301 /news/2012/03/new-8-tonne-volvo-added-to-fleet/    https://www.example.com/new-8-tonne-volvo-added-to-fleet/
redirect 301 /news/2012/03/new-tillers-ready-for-spring/    https://www.example.com/new-honda-tillers/
redirect 301 /news/2012/03/ready-for-a-flood-of-hires/  https://www.example.com/ready-for-a-flood-of-hires/
redirect 301 /news/2012/03/new-bomag-80ad-5-roller/ https://www.example.com/new-bomag-80ad-5-roller/
redirect 301 /news/2012/01/compressor-order-completed/  https://www.example.com/compressor-order-completed/
redirect 301 /news/2012/01/new-3-tonne-excavator-added/ https://www.example.com/new-3-tonne-excavator-added/
redirect 301 /news/2011/11/new-compressor-arrives/  https://www.example.com/new-compressor-arrives/
redirect 301 /news/2011/11/new-generators-arrive/   https://www.example.com/new-generators-arrive/
redirect 301 /news/2011/11/another-new-k008-excavator-arrives/  https://www.example.com/another-new-k008-excavator-arrives/
redirect 301 /news/2011/05/new-kubota-k008-digger-arrives/  https://www.example.com/new-kubota-k008-excavator-arrives/
redirect 301 /news/2011/04/new-9hp-rotavator/   https://www.example.com/new-9hp-rotavator/
redirect 301 /news/2011/04/two-new-thwaites-1-tonne-hi-tips/    https://www.example.com/new-thwaites-hi-tip-dumpers/
redirect 301 /news/2011/03/new-fencing/ https://www.example.com/new-fencing/
redirect 301 /news/2011/03/new-turf-cutters/    https://www.example.com/new-turf-cutters/
redirect 301 /news/2011/03/new-3-tonne-excavator-arrives/   https://www.example.com/new-3-tonne-excavator-arrives/
redirect 301 /news/2011/01/central-heating-power-flusher-joins-our-range/   https://www.example.com/central-heating-power-flusher-joins-our-range/
redirect 301 /news/2010/11/extra-fein-multimaster-added/    https://www.example.com/extra-fein-multimaster-added/
redirect 301 /news/2010/11/new-scarifier-joins-our-range/   https://www.example.com/new-scarifier-joins-our-range/
redirect 301 /news/2010/10/new-tile-stripper/   https://www.example.com/new-tile-stripper/
redirect 301 /news/2010/09/disc-cutter-fleet-now-100-stihl/ https://www.example.com/disc-cutter-fleet-now-100-stihl/
redirect 301 /news/2010/05/two-new-3-tonne-dumpers-arrive/  https://www.example.com/two-new-3-tonne-dumpers-arrive/
redirect 301 /news/2010/04/hire-deal-of-the-month-may-2010/ https://www.example.com/hire-deal-of-the-month-may-2010/
redirect 301 /news/2010/04/four-new-2-tonne-dumpers-arrive/ https://www.example.com/four-new-2-tonne-dumpers-arrive/
redirect 301 /news/2010/03/hire-deal-of-the-month-march-2010/   https://www.example.com/hire-deal-of-the-month-march-2010/
redirect 301 /news/2010/01/hire-deal-of-the-month-february-2010/    https://www.example.com/hire-deal-of-the-month-february-2010/
redirect 301 /news/2009/12/roller-strikers-join-our-range/  https://www.example.com/roller-strikers-join-our-range/
redirect 301 /news/2009/11/new-website-launched/    https://www.example.com/new-website-launched/
redirect 301 /news/2009/10/featured-equipment-thwaites-1-tonne-hi-tip-dumper/   https://www.example.com/featured-equipment-thwaites-1-tonne-hi-tip-dumper/
redirect 301 /news/2009/10/how-to-sand-a-floor/ https://www.example.com/how-to-sand-a-floor/
redirect 301 /news/2009/10/combating-flood-damage/  https://www.example.com/combating-flood-damage/
redirect 301 /news/2009/10/featured-equipment-temporary-fencing/    https://www.example.com/featured-equipment-temporary-fencing/
redirect 301 /news/2009/10/featured-equipment-volvo-ec55-excavator/ https://www.example.com/featured-equipment-volvo-ec55-excavator/
redirect 301 /news/2009/10/featured-equipment-volvo-8-tonne-excavator/  https://www.example.com/featured-equipment-volvo-8-tonne-excavator/
redirect 301 /news/2009/10/featured-equipment-skip-loading-power-barrows/   https://www.example.com/featured-equipment-skip-loading-power-barrows/
redirect 301 /news/2009/10/featured-equipment-rotavators/   https://www.example.com/featured-equipment-rotavators/
redirect 301 /news/2009/10/featured-equipment-kubota-k008-excavator/    https://www.example.com/featured-equipment-kubota-k008-excavator/
redirect 301 /news/2009/10/featured-equipment-floor-sanders/    https://www.example.com/featured-equipment-floor-sanders/
redirect 301 /news/2009/04/three-wishes-from-genie/ https://www.example.com/three-wishes-from-genie/
redirect 301 /news/2009/04/triple-bill-of-new-rollers-arrive/   https://www.example.com/triple-bill-of-new-rollers-arrive/
redirect 301 /news/2009/04/trio-of-kx36s-join-digger-fleet/ https://www.example.com/trio-of-kx36s-join-digger-fleet/
redirect 301 /news/2009/03/two-new-stihl-pressure-washers-added/    https://www.example.com/two-new-stihl-pressure-washers-added/
redirect 301 /news/2009/03/two-new-5-tonne-volvos-arrive/   https://www.example.com/two-new-5-tonne-volvos-arrive/
redirect 301 /news/2009/03/new-laser-level-added/   https://www.example.com/new-laser-level-added/
redirect 301 /news/2009/02/didcot-plant-focus-issue-6/  https://www.example.com/didcot-plant-focus-issue-6/
redirect 301 /news/2008/12/reversible-plates-return/    https://www.example.com/reversible-plates-return/
redirect 301 /news/2008/10/bomag-rollers-get-some-tlc/  https://www.example.com/bomag-rollers-get-some-tlc/
redirect 301 /news/2008/10/2nd-genie-lift-added-to-hire-fleet/  https://www.example.com/2ns-genie-lift-added-to-hire-fleet/
redirect 301 /news/2008/07/long-reach-hedge-trimmer-joins-range/    https://www.example.com/long-reach-hedge-trimmer-joins-range/
redirect 301 /news/2008/07/your-wish-is-our-command/    https://www.example.com/your-wish-is-our-command/
redirect 301 /news/2008/07/new-gardening-equipment-added/   https://www.example.com/new-gardening-equipment-added/
redirect 301 /news/2008/06/stump-grinder-added-to-range/    https://www.example.com/stump-grinder-added-to-range/
redirect 301 /news/2008/06/rammer-fleet-increased/  https://www.example.com/rammer-fleet-increased/
redirect 301 /news/2008/06/new-air-conditioners-join-hire-fleet/    https://www.example.com/new-air-conditioners-join-hire-fleet/
redirect 301 /news/2008/05/didcot-plant-focus-issue-3/  https://www.example.com/didcot-plant-focus-issue-3/
redirect 301 /news/2008/04/bumpa-hoist-added-to-range/  https://www.example.com/bumpa-hoist-added-to-range/
redirect 301 /news/2008/03/new-kubota-kx71-joins-hire-fleet/    https://www.example.com/new-kubota-kx71-joins-hire-fleet/
redirect 301 /news/2008/03/didcot-plant-focus-issue-2/  https://www.example.com/didcot-plant-focus-issue-2/
redirect 301 /news/2008/02/two-new-kubota-kx36s-arrive/ https://www.example.com/two-new-kubota-kx36s-arrive/
redirect 301 /news/2008/01/new-volvo-5t-breaker/    https://www.example.com/new-volvo-5t-breaker/
redirect 301 /news/2008/01/a-busy-year/ https://www.example.com/a-busy-year/
redirect 301 /news/2008/01/99-vat-cordless-drill/   https://www.example.com/99-vat-makita-cordless-drill/
redirect 301 /news/2008/01/website-continues-to-be-upgraded/    https://www.example.com/website-continues-to-be-upgraded/
redirect 301 /news/2008/01/new-vehicles-grace-our-fleet/    https://www.example.com/new-vehicles-grace-our-fleet/
redirect 301 /news/2008/01/80-tonner-free-again/    https://www.example.com/8-0-tonner-free-again/
redirect 301 /news/2008/01/new-dehumidifiers/   https://www.example.com/new-dehumidifiers/
redirect 301 /news/2008/01/didcot-plant-focus-issue-1/  https://www.example.com/didcot-plant-focus-issue-1/
redirect 301 /news/2007/12/didcot-plant-news-december-2007/ https://www.example.com/didcot-plant-news-december-2007/
redirect 301 /news/2007/11/didcot-plant-news-november-2007/ https://www.example.com/didcot-plant-news-november-2007/
redirect 301 /news/2007/10/didcot-plant-news-october-2007/  https://www.example.com/didcot-plant-news-october-2007/
redirect 301 /news/2007/09/didcot-plant-news-september-2007/    https://www.example.com/didcot-plant-news-september-2007/
redirect 301 /news/2007/08/didcot-plant-news-august-2007/   https://www.example.com/didcot-plant-news-august-2007/
redirect 301 /news/2007/07/didcot-plant-news-july-2007/ https://www.example.com/didcot-plant-news-july-2007/
redirect 301 /news/2007/06/didcot-plant-news-june-2007/ https://www.example.com/didcot-plant-news-june-2007/
redirect 301 /news/2007/05/didcot-plant-news-may-2007/  https://www.example.com/didcot-plant-news-may-2007/
redirect 301 /news/2007/04/didcot-plant-news-april-2007/    https://www.example.com/didcot-plant-news-april-2007/
redirect 301 /news/2007/03/didcot-plant-news-march-2007/    https://www.example.com/didcot-plant-news-march-2007/
redirect 301 /news/2007/02/didcot-plant-news-february-2007/ https://www.example.com/didcot-plant-news-february-2007/
redirect 301 /news/2007/01/didcot-plant-news-january-2007/  https://www.example.com/didcot-plant-news-january-2007/
redirect 301 /news/2006/12/didcot-plant-news-december-2006/ https://www.example.com/didcot-plant-news-december-2006/
redirect 301 /news/2006/11/didcot-plant-news-november-2006/ https://www.example.com/didcot-plant-news-november-2006/
redirect 301 /news/2006/08/didcot-plant-news-august-2006/   https://www.example.com/didcot-plant-news-august-2006/
redirect 301 /news/2006/06/didcot-plant-news-june-2006/ https://www.example.com/didcot-plant-news-june-2006/
redirect 301 /news/2006/02/didcot-plant-news-february-2006/ https://www.example.com/didcot-plant-news-february-2006/
redirect 301 /news/2005/12/didcot-plant-news-december-2005/ https://www.example.com/didcot-plant-news-december-2005/
redirect 301 /news/2005/08/didcot-plant-news-august-2005/   https://www.example.com/didcot-plant-news-august-2005/
redirect 301 /news/2005/07/didcot-plant-news-july-2005/ https://www.example.com/didcot-plant-news-july-2005/
redirect 301 /news/2005/05/didcot-plant-news-may-2005/  https://www.example.com/didcot-plant-news-may-2005/
redirect 301 /news/2005/04/didcot-plant-news-april-2005/    https://www.example.com/didcot-plant-news-april-2005/
redirect 301 /news/2005/03/didcot-plant-news-march-2005/    https://www.example.com/didcot-plant-news-march-2005/
redirect 301 /news/2005/02/didcot-plant-news-february-2005/ https://www.example.com/didcot-plant-news-february-2005/
redirect 301 /news/2004/12/didcot-plant-news-december-2004/ https://www.example.com/didcot-plant-news-december-2004/
redirect 301 /news/2004/11/didcot-plant-news-november-2004/ https://www.example.com/didcot-plant-news-november-2004/
redirect 301 /news/2004/09/didcot-plant-news-september-2004/    https://www.example.com/didcot-plant-news-september-2004/
redirect 301 /news/2004/08/didcot-plant-news-august-2004/   https://www.example.com/didcot-plant-news-august-2004/
redirect 301 /news/2004/07/didcot-plant-news-july-2004/ https://www.example.com/didcot-plant-news-july-2004/
redirect 301 /news/2004/06/didcot-plant-news-june-2004/ https://www.example.com/didcot-plant-news-june-2004/
redirect 301 /news/2004/05/didcot-plant-news-may-2004/  https://www.example.com/didcot-plant-news-may-2004/
redirect 301 /news/2004/04/didcot-plant-news-april-2004/    https://www.example.com/didcot-plant-news-april-2004/
redirect 301 /news/2004/03/didcot-plant-news-march-2004/    https://www.example.com/didcot-plant-news-march-2004/
redirect 301 /news/2004/02/didcot-plant-news-february-2004/ https://www.example.com/didcot-plant-news-february-2004/
redirect 301 /news/2004/01/didcot-plant-news-january-2004/  https://www.example.com/didcot-plant-news-january-2004/
redirect 301 /news/2003/11/didcot-plant-news-november-2003/ https://www.example.com/didcot-plant-news-november-2003/
redirect 301 /news/2003/08/didcot-plant-news-august-2003/   https://www.example.com/didcot-plant-news-august-2003/
redirect 301 /news/2003/07/didcot-plant-news-july-2003/ https://www.example.com/didcot-plant-news-july-2003/
redirect 301 /news/2003/05/didcot-plant-news-may-2003/  https://www.example.com/didcot-plant-news-may-2003/
redirect 301 /news/2002/12/didcot-plant-news-december-2002/ https://www.example.com/didcot-plant-news-december-2002/
redirect 301 /news/2002/10/didcot-plant-news-october-2002/  https://www.example.com/didcot-plant-news-october-2002/
redirect 301 /news/2002/09/didcot-plant-news-september-2002/    https://www.example.com/didcot-plant-news-september-2002/
redirect 301 /news/2002/06/didcot-plant-news-june-2002/ https://www.example.com/didcot-plant-news-june-2002/
redirect 301 /news/2002/04/didcot-plant-news-april-2002/    https://www.example.com/didcot-plant-news-april-2002/
redirect 301 /news/2002/03/didcot-plant-news-march-2002/    https://www.example.com/didcot-plant-news-march-2002/
redirect 301 /news/category/news/   https://www.example.com/category/news/
redirect 301 /news/category/featured-equipment/ https://www.example.com/category/featured-equipment/
redirect 301 /news/category/articles/   https://www.example.com/category/news/
redirect 301 /news/2021 https://www.example.com/2021/
redirect 301 /news/2020 https://www.example.com/2020/
redirect 301 /news/2019 https://www.example.com/2019/
redirect 301 /news/2018/    https://www.example.com/2018/
redirect 301 /news/2017/    https://www.example.com/2017/
redirect 301 /news/2016/    https://www.example.com/2016/
redirect 301 /news/2015/    https://www.example.com/2015/
redirect 301 /news/2014/    https://www.example.com/2014/
redirect 301 /news/2013/    https://www.example.com/2013/
redirect 301 /news/2012/    https://www.example.com/2012/
redirect 301 /news/2011/    https://www.example.com/2011/
redirect 301 /news/2010/    https://www.example.com/2010/
redirect 301 /news/2009/    https://www.example.com/2009/
redirect 301 /news/2008/    https://www.example.com/2008/
redirect 301 /news/2007/    https://www.example.com/2007/
redirect 301 /news/2006/    https://www.example.com/2006/
redirect 301 /news/2005/    https://www.example.com/2005/
redirect 301 /news/2004/    https://www.example.com/2004/
redirect 301 /news/2003/    https://www.example.com/2003/
redirect 301 /news/2002/    https://www.example.com/2002/
16
  • 1
    Do you have other RewriteRules? For example is there a rule to rewrite /hire-category/access-support-equipment/ to some PHP script? May 8 at 19:32
  • 1
    "But that isn't working for me" - In what way is it not working exactly? Do you get an error? Undesirable redirect? Nothing?! Where are you using this directive? The directive you posted assumes you are using .htaccess on Apache 2.4, in which case it would appear to do precisely what you are asking.
    – MrWhite
    May 9 at 0:54
  • Do you have a RewriteEngine On directive? (Need to ask, as it's not explicitly included in the question you've referenced.)
    – MrWhite
    May 9 at 1:04
  • Thanks all for your questions.
    – webfooted
    May 9 at 8:00
  • 1
    Although that Redirect directive does something quite different to what you are trying to do in the question and completely ignores the query string? It would redirect /catalogue/catalogue.php?catSection=1 to /hire-catalogue/catalogue.php?catSection=1. If you edit your question to include the contents of your .htaccess file this should be relatively trivial to resolve. (There is an "edit" link immediately below the question.) Also, do you have any other .htaccess files along the filesystem path?
    – MrWhite
    May 9 at 9:49
1

You've not actually shown the new directives (mod_rewrite RewriteRule / RewriteCond) in-place in your .htaccess file, but my guess is that you were putting the directives in the wrong place. Order matters. If you place the mod_rewrite directives together with your mod_alias Redirect directives, after the WordPress front-controller (# BEGIN WordPress section) then it's not going to do anything because /catalogue/catalogue.php (which does not exist) is rewritten to /index.php before your redirect occurs at which time processing stops and the redirect never occurs, resulting in a 404 from WordPress.

You need to place the new redirect, ie. the mod_rewrite RewriteRule (and RewriteCond) directives before the existing mod_rewrite directives, ie. before the # BEGIN WordPress section, near the top of your .htaccess file.

You will need to clear your browser cache before testing since the existing 301 (permanent) redirect will have been cached by the browser. For this reason it is beneficial to first test with 302 (temporary) redirects which are not cached by default.

The mod_alias Redirect directives are OK where they are, later in the file, after the WordPress front-controller, because they belong to a different Apache module and always work on the initial request (not the rewritten request).

RewriteEngine, RewriteRule (and RewriteCond) directives are part of mod_rewrite. However, Redirect is a mod_alias directive. Different Apache modules work independently and are processed at different times during the request, despite the apparent order of directives in the config file. mod_rewrite always runs before mod_alias. For this reason, it is generally advisable to not mix redirects from both modules, since you can get unexpected conflicts.

Consequently, the RewriteEngine directive has nothing to do with the mod_alias Redirect directive. Although where you've placed the RewriteEngine directive would seem to suggest you think there is? There's also no need to repeat the RewriteEngine directive. Only the last instance of the RewriteEngine directive actually does anything and controls the entire file.


Aside: From comments...

is there a rule to rewrite /hire-category/access-support-equipment/ to some PHP script?

I haven't got any rules rewriting to PHP scripts.

This is precisely what the existing WordPress directives do (the part in the # BEGIN WordPress section). It internally rewrites /hire-category/access-support-equipment/ to /index.php (the WordPress front-controller).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.