domain.com/gallery/
RewriteRule ^gallery/([^/]*)/$ gallery/?&img=$1 [QSA,L]
domain/gallery/2412/
domain.com/gallery/?img=2412
This question has been answered by opengeek. See the first response.
if ($modx->event->name == 'OnPageNotFound'){
$arrayURI = explode('/',$_SERVER['REQUEST_URI']);
$albumId = explode('-',$arrayURI[2]);
if($arrayURI[1] == 'gallery' && $albumId[0] == 'album'){
$_REQUEST['img'] = $albumId[1];
$modx->sendForward(83); // 83 - is the id of the resource gallery
}
return '';
}Hi,Can you try adjusting your RewriteRule to the following?
RewriteRule ^gallery/([^/]*)/$ gallery/?&img=$1 [QSA,L]
RewriteRule ^gallery/([^/]*)/$ gallery/?img=$1 [QSA,L]
Can you try adjusting your RewriteRule to the following?Tried it. No change. Still a 301.
RewriteRule ^gallery/([^/]*)/$ gallery/?img=$1 [QSA,L]
Options +FollowSymlinks RewriteRule ^gallery/([^/]*)/$ /index.php?q=gallery/?img=$1 [N]
Mh... This won't work because of1) If you have a query in the form of domain/gallery/2412 / it works OnPageNotFound, why do you think that the resource will be found?
1st: I don't think OnPageNotFound will be triggered, cause the page is found, right?
2nd: It's a quiet complex website. With some more pages that uses GET-parameter like this (also dynamic created resources). So I would have to create Plugins vor a lot of resources. That can't work.
if ($modx->event->name == 'OnPageNotFound'){
$arrayURI = explode('/',$_SERVER['REQUEST_URI']);
if($arrayURI[1] == 'gallery' ){
$_REQUEST['img'] = $arrayURI[2];
$modx->sendForward(83); // 83 - is the id of the resource gallery
}
return '';
}I have worked in such a record. htaccessAlso produces a 301.
Options +FollowSymlinks RewriteRule ^gallery/([^/]*)/$ /index.php?q=gallery/?img=$1 [N]