php - htacces rewrite on urls -
hi can me want rewrite bad php urls in htaccess have urls on site looks this: http://www.spellentuin.nl/puzzel-spellen.php?pag=2&order= , on every following page must show this: http://www.spellentuin.nl/puzzel-spellen2.php (order= must dissapear , next page must puzzel-spellen3.php , on) need put in htaccess done , need put same code every page have because have lot of different game category pages? @ moment google not index of following pages. if have better ideas puzzel-spellen2.php please suggest also.
many help!
the rewrite rule pretty straight forward (if have case)
rewriteengine on rewriterule ^puzzel-spellen([0-9]+).php$ /puzzel-spellen.php?pag=$1&order=
in order use this, have modify every link. done register output filter (this has placed @ beginning of scripts - before output anything)
ob_start(function($str) { return preg_replace( '/\/puzzel-spellen\.php\?pag=([0-9]+)&order=/', 'puzzel-spellen$1.php', $str); });
but better solution modify every link. i.e.
'<a href="puzzel-spellen.php?pag=' . $i . '&order=' . urlencode($_get['order'])
just becomes (as dont want order included)
'<a href="puzzel-spellen' . $i . '.php'
Comments
Post a Comment