I am relatively new to URL rewriting. I recently created a forum and wishes to rewrite some of the thread URLs.

I want to internally rewrite this link

(on client side)

to this link

www.example.com/topic?id=306&slug=slug-title&page=6 (on server side)

I also want users who enter just only the topic ID without the slug title to be redirected (301: with their URL bar changed ) to the correct link where the slug title is included. For instance

A user who enters this link


should be 301 redirected to this link


Which will then be internally re-written on the server side to this


Please how do I go about this using URL rewriting.

NOTE: The behavior I want to achieve is exactly being exhibited by the link to this question


Remove the slug title


hit Go on your browser and you get sent back to the correct link


Although I have little knowledge of Regex, but a step by step guide will be highly appreciated.


closed as too broad by John Conde May 13 '17 at 21:08

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.