Using custom url parameters in a page

My initial thought without being able to do further testing is that your custom galleri page is looking for the URL parameters in order to determine which post to pull images from. However, since you’re rewriting the URL, those URL parameters don’t technically exist (I could be wrong about this – I’m not at a spot where I can do testing and I don’t know your exact code).

If your goal is to have user friendly URLs, you could go with a different approach than URL parameters. You could get the value of the $_SERVER[“REQUEST_URI”] variable, split it on the “https://wordpress.stackexchange.com/” and determine the post from there.

[EDIT]

<?php
$currentUrl = $_SERVER["REQUEST_URI"];
$arrUrlParts = explode( "https://wordpress.stackexchange.com/" , $currentUrl );

#Assuming that your URL is "http://kurdaktuellt.se/galleri/images/1598/", the variables would end up looking like this:

# $currentUrl contains "/galleri/images/1598/"
# $arrUrlParts[0] contains ""
# $arrUrlParts[1] contains "galleri"
# $arrUrlParts[2] contains "images"
# $arrUrlParts[3] contains "1598"
?>

In the case above, $arrUrlParts[3] would contain the number that you’re looking for.