Wednesday double post of doom...part 1
Today i’m doing two posts, I know, what kind of crazy man am I?! The first post is a little htaccess wizardry.
This morning I was finishing off some SEF tweaks to an existing site, but there was one contentious issue with an article. The article was a case study about hotels, so you would want it under /case-studies/hotels for SEF, but due to Joomla menu’s it was stuck under /case-studies/ (the main case studies menu item goes straight to hotels). The way around this was to create a 301 redirect in the sites .htaccess file, however a normal redirect did not work and sent the site into a loop. This is because it constantly finds /case-studies and keeps appending /hotels on to the end. So you can use RedirectMatch, which uses regular expressions to only redirect the string you enter. So the final redirect became:
RedirectMatch 301 ^/case-studies$ /case-studies/hotels
Part two will be coming your way later :)