简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM