phpwordpress.htaccessmod-rewritepretty-urls

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:

http://beta.ivech.co.uk/index.php/hire-vehicle-detail?id=1

and I would like it to look like the following:

http://beta.ivech.co.uk/hire-vehicle-detail/1

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]
</IfModule>
# 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.


Solution

  • Try the following (verified by http://martinmelin.se/rewrite-rule-tester/):

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

    see also http://wettone.com/code/clean-urls