I am testing ready to move a static htm site to cloudways. So I set up php application>deleted index.php > replaced with index.htm, added .htaccess in the public_html and set DirectoryIndex order with index.htm first.
I added some of the .htaccess rules that work properly on my current server - A2 shared Turbo Apache hosting.
And, the rules work perfectly BUT not if I type a url to a page or file that exists on the cloudways/digital ocean servers.
These all work as they should: (i had to add spaces and such to the url’s be allowed to post)
example .co .uk > https www. example .co .uk/
www .example .co .uk >https www. example .co .uk/
https:// example .co .uk > https www. example .co .uk/
server ip address > https www. example .co .uk/
server ip address/index.php > https www. example .co .uk/
https:// www .example .co .uk/index.php > https www .example .co .uk
example .co .uk/index.php > https www .example .co .uk
BUT as soon as I type in URL or filename that exists on the server the rewrites STOP working. It’s as if I didn’t have any rewrites within the .htaccess at all.
example .co .uk/index.htm > example .co .uk/index.htm
www .example .co .uk/index.htm > www .example .co .uk/index.htm
https example .co .uk.index.htm > https example .co. uk/index.htm
https www .example .co .uk/index.htm > https example .co .uk/index.htm
server ip address/index.htm > server ip address/index.htm
www .example .co .uk/image.jpg > www .example .co .uk/image.jpg
example. co. uk/image.jpg > example .co .uk/image.jpg
But as soon as the url relates to a page or file that doesn’t exist the rewrites work fine but obviously ends in a 404 page
example .co .uk/dontexist.jpg > https www .example .co .uk/dontexist.jpg
example .co .uk/dontexist.htm > https www .example .co .uk/dontexist.htm
https:// example .co .uk/dontexist.jpg > https www .example .co .uk/dontexist.jpg
How can I get the rewrites to work when a page or file is already on the server and can be served?