DEV Community

Billy Okeyo
Billy Okeyo

Posted on

URL Rewriting

How do you make URL rewriting show in the browser address bar using .htaccess, I need some help with that

Top comments (5)

Collapse
 
vlasales profile image
Vlastimil Pospichal

I don't rewrite URLs, just redirect to index.php

Collapse
 
billy_de_cartel profile image
Billy Okeyo

Will redirecting remove the ugly URL like posts.php?id=12 or something of the sort

Collapse
 
vlasales profile image
Vlastimil Pospichal

Yes, when URL is example.com/post/12 , redirect it to index.php without rewriting. The script get this string from $_SERVER['REQUEST_URI'] and parse it with function parse_url(). The component 'path' I parse with explode(). That's all.

Thread Thread
 
billy_de_cartel profile image
Billy Okeyo

Let me try it then i share the feedback

Collapse
 
billy_de_cartel profile image
Billy Okeyo

Anyone who has ever worked with URL rewriting in apache