just check this within function function replace_for_mod_rewrite(&$s) { $urlin = array( "'(?<!/)apartment_page.php\?apart_id=([0-9]*)&name=(.*)'", ); $urlout = array( "\\1-apartment-\2.php\", ); $s = preg_replace($urlin, $urlout, $s); return $s; } this will work fine. and u'r .htaccess would be RewriteEngine on RewriteRule ^([0-9]*)-apartment-(.*).php apartment_page.php?apart_id=$1&name=$2 Shimul --- *^*JUNAID*^* <junaidfcs@xxxxxxxxx> wrote: > Hello please check the following code > function replace_for_mod_rewrite(&$s) > { > $urlin = > array( > "'(?<!/)apartment_page.php\?apart_id=([0-9]*)&name=(([[:alnum:]]|[[:blank:]]|[[:punct:]])*)'", > > ); > $urlout = array( > "\\1-apartment-\\2.php", > ); > $s = preg_replace($urlin, $urlout, $s); > return $s; > } > > i m using this function on each page of mysite where > i have links of the form say > http://www.vacanzeromane.com/eng/apartment_page?apart_id=171&name=apt. > No 14 > and want to rewrite these urls to > http://www.vacanzeromane.com/eng/171-apartment-apt. > No 14.php > > the above script is doing fine except it does not > attaching the .php with the link at the end tht's > thre resultant url is > http://www.vacanzeromane.com/eng/171-apartment-apt. > No 14 and .php separate > you can see this at > > http://www.vacanzeromane.com/eng/index.php > > the .htaccess file for this is > also check is it fine or also need some correction > > > Options +FollowSymlinks > RewriteEngine on > RewriteRule > ^([0-9]*)-apartment-(([[:alnum:]]|[[:blank:]]|[[:punct:]])*).php > apartment_page.php?apart_id=$1&name=$2 [L,NC] > > > at the moment the above does not work > or if i should use the below then it will work? > > Options +FollowSymlinks > RewriteEngine on > RewriteRule ^([0-9]*)-apartment-(.*).php > apartment_page.php?apart_id=$1&name=$2 [L,NC] > > > > JUNAID JAMEEL AHMAD > BSc Hons in CS Punjab University Lahore Pakistan > > > > --------------------------------- > Yahoo! FareChase - Search multiple travel sites in > one click. > > [Non-text portions of this message have been > removed] > > __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/saFolB/TM --------------------------------------------------------------------~-> PHP Data object relational mapping generator - http://www.meta-language.net/ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-objects/ <*> To unsubscribe from this group, send an email to: php-objects-unsubscribe@xxxxxxxxxxxxxxx <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/