I’ve recently been experiencing problems with my website which appear to be related to my .htaccess file.
The main issues are that some pages are redirecting to themselves, while others show a 300 Multiple Choices error page, which only ever has 1 page in the list.
The original setup of my .htaccess file was to both connect up my custom error pages, but also to remove the extension displayed at the end of each page (.e.g. /about.php would appear as /about).
Below is the contents of the current .htaccess file, along with a link to my site.
I have contacted my website host regarding this, though they were not able to help and advised I post on a forum to find out what is wrong. Please could someone advise?
At this point I’m unsure if there is a problem with the host’s server or if it’s something I’ve mistyped in the above…any advice would be much appreciated!
Thanks for your help Gandalf - that line was originally taken from another forum - it was recommended I use that to remove the .php extension.
I’ve now updated my htaccess as it was recommended elsewhere that I add the options for MultiView and also CheckSpelling off. However, this has now caused all page links to redirect back to the homepage.
I realised I’d accidentally included a few duplicate lines for the Rewrite Engine and RewriteCond.
However, my pages are still redirecting either to the homepage or a Multiple Choices error.
It looks relatively harmless, but in some cases, depending on the directory structure and file locations, RewriteBase can cause problems. Are you certain you need that directive?
Thanks for your help, I’ve added the Rewrite Rule back in and also removed the Rewrite Base / line and the URLs without an extension are now working. After testing between the versions it seems that the “Rewrite Base /” line was indeed causing the main issue.
I’m unclear how that line has appeared to be honest as I haven’t touched the htaccess file for quite some time and the site was working up until a few months ago. Either way, it seems I need to learn a bit more about Apache and htaccess!