user1530205 user1530205 - 1 year ago 92
PHP Question

URL Pretty rewrite

I'm having a bit trouble generating an htaccess file for a wordpress page. I won't delve into the specifics regarding the page but please know the way things are being done is necessary.

I have the following url:

and I would like it to look like the following:

I've managed to remove the index.php with the standard Wordpress htaccess file but I'm struggling with the pretty URL side of things.

Here's what I have at the moment:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

I've tried other rules generated online to do the pretty url stuff but had no luck. Truth be told, I'm not entirely sure where I would even put the rule within the above code. Any help is greatly appreciated.

Answer Source

Try the following (verified by

RewriteRule ^hire-vehicle-detail/(.+)$ index.php/hire-vehicle-detail.php?id=$1

see also

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download