Jump to content

url rewriting help


thara

Recommended Posts

everyone..

 

I need to rewrite this URL

 

 

like this

 

 

 

can anybody help me to do this using Apache’s mod_rewrite feature.

 

any comments are greatly appreciated.

 

Thank you.

Link to comment
Share on other sites

this is my original URL

 

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

 

I need to rewrite it like this

 

http://localhost/tutor_institute/profiles/tutors/1255/Perth/Jhon Amarathunga.html

 

here tutor_insitute, profiles and tutors are sub directories in my root directory. index.php page exist in tutors directory and also my htaccess file placed there.

 

I did in my htaccess file like this

 

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

 

but it is not working.. anybody tell me where I have gone wrong?

 

Thank you.

Link to comment
Share on other sites

For future reference, that means In My Opinion. (IMHO = same with HONEST).

Thanks for it..

 

[A-Za-z_]+

 

I change it like this

 

[A-Za-z_-+]+

 

But still my browser URL is same. it is not changing as I expect.

Link to comment
Share on other sites

Wait, I think you have this backwards.

 

The purpose of modrewrite it to accept a URL like

http://www.mydomain.com/profiles/tutors/1255/Kasun+Perera

 

and translate it to

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

 

So that index.php gets run.

 

 

It does not change the URL in your existing link attributes.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.