Hi all. Thanks for the advice so far.
I am passing some details to a page using a query string, which generates a URL in this format:
I then use this code to get the data I need from the database:
$gallery = mysqli_real_escape_string($conn, $_GET['gallery']);
$link = mysqli_real_escape_string($conn, $_GET['link']);
$sql = "SELECT * FROM images WHERE link='".$link."'";
This all works fine and the page works as needed. As part of set up and testing I echo the $link variable to the page and it displays correctly as: surfers-beach-goers
However to make the URL in this format: www.domain.com/surfing/surfers-beach-goers I have used the following htaccess code:
RewriteRule ^(surfing|people|places|montage)/([a-z\-]+)$ image.php?gallery=$1&link=$2.php
And this is making the page stop working. No data is returned from the query when the page is accessed in this way and when I echo the $link variable it is shown as: surfers-beach-goers.php
So something, is causing the variable to have the .php extension on the end, and as there is no matching data the query returns nothing and so the page is not populated.
I'll be honest, I have no idea where to even start looking so any advice would be great. Phrasing the issue into a google search to try and investigate has been difficult too.