Javier Villanueva
Javier Villanueva

Reputation: 4048

Custom URL rewriting in WordPress?

I have a very peculiar requirement, hopefully I can explain it without being too confusing.

I created a page template where I list some properties I get from an external XML file, so far no problems, let's say the URL is like this: http://www.mysite.com/properties/.

Each property has a link that should redirect the user to a "Single Property" page that displays more info about it.

What I was wondering is if there's a way to make the link like this http://www.mysite.com/properties/123 where 123 would be the id of the property. Basically if I have the URL like properties/some_id I want to be able to load a view file (like the single.php or page.php files) but specific to this URL condition.

Is this possible?

Upvotes: 0

Views: 219

Answers (1)

undone
undone

Reputation: 7888

RewriteRule ^properties/(\d+)$    single.php?id=$1

it will send number(123 in your case) as id to single.php

Upvotes: 1

Related Questions