I have a custom page in wordpress that uses a custom plugin which is connecting to an API to retrieve information.
The client has asked that we don't pass id's via the url as below:
http://beta.hirehere.co.uk/hire-vehicle-detail/?id=4
but instead use a category name such as:
http://beta.hirehere.co.uk/hire-vehicle-detail/?vehicle_category_name=economy
initially I was using a URL rewrite to pretty things up so:
http://beta.hirehere.co.uk/hire-vehicle-detail/4
and thought I would just change it to:
http://beta.hirehere.co.uk/hire-vehicle-detail/economy
I would then adjust the code accordingly. I've done this yet the URL rewrite does not seem to be happy and returns a 404 error but it works if I access the direct url of:
http://beta.hirehere.co.uk/hire-vehicle-detail/?vehicle_category_name=economy
Here is my htaccess file, any help is greatly appreciated:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^hire-vehicle-detail/(.+)$ index.php/hire-vehicle-detail?vehicle_category_name=$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
PS. The above htaccess code worked in the scenario of using ID's instead
Edit: it appears wordpress is trying to access a sub-page (economy) of the parent page (hire-vehicle-detail). I know this because if I create the page economy as a child of hire-vehicle-detail the url takes me there. Is there anyway to stop this