Struggling. Help!
In index.php:
require "cachedPages/home.html";
If I visit: https://websiteaddress.org/index.php then it works fine.
If I visit: https://websiteaddress.org then I get an internal server error.
I guess it’s a .htaccess thing. All I have in there is some cpanel php72 code and:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
DirectoryIndex index.php
It seems there’s some difference between how index.php is called if you call it directly as opposed to .htaccess calling it for you?!?
Any ideas?
Thanks in advance.
2
Answers
Well, I've managed to sort the problem, but it's a pretty weird situation that no-one else will probably ever experience. Here goes...
If the user lands at: https://websiteaddress.org rather than https://websiteaddress.org/index.php and that page (php) requires another page, which has images that are embedded as URIs rather than linked src files.
Then, the first URI causes a server error.
If I replace the
with
on the first instance of a jpg then it all works fine. All the later URIs are fine, it's just the first instance!
It all works now, with this workaround; and the situation is so unique and bizarre that I doubt this thread will be of use to anyone else. In fact it's so edge-case that I can't be bothered investigating it any further myself.
If you don’t have one of the following options in your .htaccess then Apache won’t know which file to default back to:
Also I’d recommend installing mod_rewrite as well. It’s handy for other reasons.