Page 1 of 1

RewriteURL

Posted: Thu Jun 08, 2006 7:56 pm
by myinnet
i need help, i have a table, like :
******
id, topic, content
******

on the page, it normally show like this one:
<a href=view.php?id=1>This is a test</a>

i would like this link looks like:

<a href=this_is_a_test_1.html>This is a test</a>

How to do that?
thanks
MyInnet

Posted: Thu Jun 08, 2006 9:13 pm
by tecktalkcm0391
I really don't get what your asking...

Posted: Thu Jun 08, 2006 9:24 pm
by bdlang
Unless I'm mistaken, you want to use Apache's mod_rewrite module.

I'm somewhat familiar with this method, having used it in a couple of instances, but I'm quite sure the exact URL you want isn't quite possible. You'll normally change a URL like

Code: Select all

<a href="view.php?id=1">test</a>
to

Code: Select all

<a href="view/1/">test</a>

Posted: Thu Jun 08, 2006 10:03 pm
by myinnet
bdlang wrote:Unless I'm mistaken, you want to use Apache's mod_rewrite module.

I'm somewhat familiar with this method, having used it in a couple of instances, but I'm quite sure the exact URL you want isn't quite possible. You'll normally change a URL like

Code: Select all

<a href="view.php?id=1">test</a>
to

Code: Select all

<a href="view/1/">test</a>
This is ok, but how to write the rules, and .htaccess.
thanks

Posted: Thu Jun 08, 2006 10:05 pm
by bdlang
myinnet wrote: This is ok, but how to write the rules, and .htaccess.
thanks
Different forum, possibly different website, definitely different user. ;)

Posted: Thu Jun 08, 2006 11:42 pm
by myinnet
what your mean? can you tell me how to do that?

Posted: Fri Jun 09, 2006 12:25 am
by RobertGonzalez
bdlang wrote:Unless I'm mistaken, you want to use Apache's mod_rewrite module.

I'm somewhat familiar with this method, having used it in a couple of instances, but I'm quite sure the exact URL you want isn't quite possible. You'll normally change a URL like

Code: Select all

<a href="view.php?id=1">test</a>
to

Code: Select all

<a href="view/1/">test</a>
No, it is entirely possible. The thing to remember is that mod_rewrite is not rewriting your URL. It is using a regex rule to take what is in the address bar into and translate that into something else while leaving the address bar alone. As an example, it could take the URL ...

Code: Select all

<a href="this-is-a-file,withaquerystring,separated,by,commas.holycowpaddies">Hello World</a>
And pipe the page to this_is_a_file.php?qs=querystring&sep=separated&how=by&what=commas without the user seeing a change in the URL address bar in their browser.

To the original poster, google search for 'mod_rewrite tutorials', check out the mod_rewrite cheat sheet and also have a look in this community, notably under the Apache, IIS, Web Servers forum.

Posted: Fri Jun 09, 2006 8:40 am
by bdlang
Thanks, Everah. :)