If we talk about on page optimization in seo then URL Optimization is the first step. During the url optimization we keep in mind these things.
Include the Exact Target Keyword
When possible include your exact target keyword in your URL.
301 Redirect Broken URLs
If you must change a URL for any reason, just remember you are removing a page that Google has potentially indexed and other sites have linked to. You don’t want Google not indexed your url. Simply notify search engines by adding a 301 redirect from your old URL to your new URL.
Use Canonical URLs
Dynamic pages can sometimes accidentally create duplicate content, and you don’t want to get penalized for something you didn’t intentionally do, hence using canonical URLs.
Block Bad URLs with Robots.txt
Avoid being penalized for duplicate content by blocking search engines from indexing multiple URLs to the same content and other problematic URLs. Use Hyphens, Not Underscores If you’d like to separate words in your URL use dashes or hyphens, instead of underscores.
URLs Must be 100% User Friendly
If you can’t read every word in your URL, neither can search engines. That’s a huge problem because search engines know that people read URLs before clicking them, to help them understand the content of a page
You can also check this helpful link to more details