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

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay