Hi,
I have built a dynamic site with php and I'm new to URL rewriting. I want to rewrite every URL on my site.
Example :
www.domain.com/example.php?id=300 TO www.domain.com/example/300
So how can I do that ???
Thanks

here's what you need to do.

first, create a .htaccess

2.write this on the file
ErrorDocument 404 /example/

3.save the .htaccess on the example folder

4. the example folder should have an index.php so when they go to www.domain.com/example/300 which is not actually existing, the .htaccess will call the index.php then we can proceed to:

5. get the current URL that is

$_SERVER

6. cut it using explode function so you can get what data you want

7. Mark this thread as Solved

8. Cheers! :D

Member Avatar for nevvermind

Although that's a nice work-around, I'd still want to see a full-blown rewriting process (read "how-to").
I'll give it a shot:

RewriteRule ^/example.php?id=([0-9]+)$ /example/$1 [L]

Did I nail it?

yes you are right you need to convert all your link to the desired format using php

Member Avatar for nevvermind

Whoa, whoa!
You don't have to rewrite your links to any format! That's what mod_rewrite is for in the first place.

LINK

Great tip nevermind!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.