## url rewriting – Rewrite parameters as Url for SEO

Question

I have urls of this form:

example.com/event/?eventId=1
example.com/event/?eventId=2

The problem is Google is indexing only example.com/event, which is a blank page. It’s not able to display an event without the Id. I would like to rewrite this url to this form:

example.com/event/1

This will allow Google to index each event individually.

I imagine something like:

function add_eventId_rule() {
'^event/(\d*)/?',
'index.php?pagename=event&eventId=\$matches[1]',
'top'
);
}