URL rewriting

samwarez

Registered Member
Joined
Sep 17, 2015
Messages
88
Reaction score
32
I have a URL that looks like:

sampleurl.com/5645654

How would I go about converting that URL to:

sampleurl.com/5645654/post-title-here

How do I go about making friendly URLs in PHP or .htaccess?
 
It depends on your php application. Htaccess already does what it should (judging by your first URL). It forwards the request to your script. Your controller has to take the request URI and show whatever page it has to. What are you using for the backend by the way?
 
Depends on how your site is built - are you using WordPress, HTML , PHP or something else?
 
First you need to figure out what the actual url arguments are under the hood. The numeric part of sampleurl.com/5645654 will map to a $_GET variable name. IF you do not need the post title on the server script then its fine, you can forget that. The tool below is great for generating the .htacess rules

https://www.generateit.net/mod-rewrite/index.php
 
thanks

First you need to figure out what the actual url arguments are under the hood. The numeric part of sampleurl.com/5645654 will map to a $_GET variable name. IF you do not need the post title on the server script then its fine, you can forget that. The tool below is great for generating the .htacess rules

https://www.generateit.net/mod-rewrite/index.php
 
Back
Top