-2

I'd like to know how to make a url rewriting?

Basically, if I go to www.site.com/announce/123456 I'd like to actually use the page www.site.com/annouce.php?id=123456

I can't get any simple documentation about it.

Thanks


Based on Gecko's answer I made a .htaccess which works fine :

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^announce/([0-9]+)$ announce.php?id=$1 [L]
pistou
  • 2,799
  • 5
  • 33
  • 60

1 Answers1

3

You must use mod_rewrite into .htaccess file like this :

RewriteEngine On
RewriteRule ^/announce/([0-9]+)$ announce.php?id=$1 [QSA]

[QSA] flag allow you to pass other arguments in your url, like this :

www.site.com/announce/123456?arg2=test

Have fun :)

Gecko
  • 74
  • 2
  • 12