balkan7 Posted June 28, 2012 Share Posted June 28, 2012 Ok i am using this code for replace url link: $html = preg_replace('/gallery\.php\?show=([0-9]+)/i','gallery/$1',$html); with this code show me this result: gallery?show=5 i need this result: gallery/5 Quote Link to comment Share on other sites More sharing options...
xyph Posted June 28, 2012 Share Posted June 28, 2012 Huh? <?php $html = 'gallery.php?show=5'; $html = preg_replace('/gallery\.php\?show=([0-9]+)/i','gallery/$1',$html); echo $html; // outputs gallery/5 ?> Quote Link to comment Share on other sites More sharing options...
balkan7 Posted June 28, 2012 Author Share Posted June 28, 2012 Then what's wrong with my site show me gallery?show=5 .htaccess RewriteRule ^gallery/([0-9]+)/?$ gallery.php?show=$1 [QSA,L] Quote Link to comment Share on other sites More sharing options...
balkan7 Posted June 28, 2012 Author Share Posted June 28, 2012 If i use this code then show: gallery?show=5 if i remove $html = str_replace('gallery.php','gallery',$html); then show me gallery/5 How can fix it ? $html = str_replace('gallery.php','gallery',$html); $html = preg_replace('/gallery\.php\?show=([0-9]+)/i','gallery/$1',$html); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.