RewriteURL
Moderator: General Moderators
RewriteURL
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
******
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
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
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
to
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>Code: Select all
<a href="view/1/">test</a>This is ok, but how to write the rules, and .htaccess.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 liketoCode: Select all
<a href="view.php?id=1">test</a>Code: Select all
<a href="view/1/">test</a>
thanks
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
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 ...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 liketoCode: Select all
<a href="view.php?id=1">test</a>Code: Select all
<a href="view/1/">test</a>
Code: Select all
<a href="this-is-a-file,withaquerystring,separated,by,commas.holycowpaddies">Hello World</a>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.