Hello.. Everyone.

This is a problem I encountered when Im trying to convert my dynamic url to friendly url.

I have a URL like this

http://localhost/tutor_institute/profiles/tutors/index.php?tutorCode=1255&tutorName=Kevin Yank&city=Perth

I need to rewrite it like this

http://localhost/tutor_institute/profiles/tutors/1255/Perth/Kevin Yank.html

My index.php page dynamically generate more teacher's profile in my website. Thats why I need to rewrite that url to a friendly format.

the path to my index.php file from server root directory is

tutor_institute/profiles/tutors/index.php

NOTE: those 3 are sub folders in my root directory.

In my home page there are links to all tutor profiles generated by system.

It is similar to like this..

echo '<h2><a href="profiles/tutors/index.php?tutorCode=' . $row3['tutor_code'] . '&amp;tutorName=' . $row3['tutor_name'] . '&amp;city=' . $row3['city_name'] . '">' . $row3['tutor_name'] . '</a></h2>';

this is from my .htaccess file

RewriteEngine on
RewriteRule ^/profiles/tutors/([0-9]+)/([A-Za-z_]+)/([A-Za-z_]+)$ index.php?tutorCode=$1&tutorName=$2&city=$3 [NC]

but it is not generating my expected url. can any body tell me what is I have made mistake.?

I have placed my .htaccess file in to 'tutor' sub directory which contain my index.php file.

any comments are greatly appreciated.

thank you very much..

    Can I rewrite URL in localhost? for 3 days I am trying to rewrite my URL in localhost.. still I cant get it works..

    any comments are greatly appreciated.

    Thank You.

      Write a Reply...