I've built a WordPress website which incorporates an external vacancy-database. The vacancies are loaded through an iframe on the WordPress vacancies page. Each of the vacancies has a unique ID, which generates a URL such as vacancies?ID=22342302. The problem is, that I would like to generate a friendly URL such as vacancies/junior-storemanager. However, WordPress does not allow for the creation of these friendly URL's. From the people who provide the vacancies databsae, I'm told that there probably is a .htaccess rewrite rule which will actually allow this, but they cannot tell me what the rule is. Is there someone out there who knows how to deal with this?
Asked
Active
Viewed 153 times
1 Answers
0
You're not going to be able to get ID=22342302
and turn it into junior-storemanager
using the htaccess file.
The htaccess file has no idea what IDs map to what keywords. You're going to have to rewrite some sort of script to do this for you and have the htaccess file route all "vacancies" through the script. Something like:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^vacancies/(.*)$ /vacancies_mapping.php?name=$1 [L,R=301]
In your vacancies_mapping.php
file, you'll look for $_GET['name']
, and then go through the vacancies database to look for what the ID is.

Jon Lin
- 142,182
- 29
- 220
- 220