How to Rewrite URLs in Simple English

I read a lot about rewriting URLs, but I still don't get it.

I understand that a url like

http://www.example.com/Blog/Posts.php?Year=2006&Month=12&Day=19 

can be replaced by more friendly, for example

 http://www.example.com/Blog/2006/12/19/ 

and the server code may remain unchanged because there is a filter that converts the new URL and sends it to the old one, but does it also replace the URLs in the response HTML?

If the server code remains unchanged, then it is possible that in my returned HTML code I have links like:

 http://www.example.com/Blog/Posts.php?Year=2006&Month=12&Day=20 http://www.example.com/Blog/Posts.php?Year=2006&Month=12&Day=21 http://www.example.com/Blog/Posts.php?Year=2006&Month=12&Day=22 

This defeats the goal of having good URLs if my page still has old ones.

Does the URL (with filter or something else) rewrite this content in HTML?

To put in another way ... are the rewrite rules applied for the incoming request, as well as for the content of the HTML response?

Thanks!

+4
source share
1 answer

The rewriting URL simply accepts the incoming URL, and if it matches a specific pattern, it translates it into a URL that the server understands (provided that the rewriting rules are correct).

This means that a certain resource can be accessed in several ways, but this does not “defeat the point”, since the point must have beautiful URLs that you still do.

They do not rewrite outgoing content, but only the incoming URL.

+1
source

All Articles