Rewrite trouble

I am having some rewrite trouble of an odd URL structure on my page. I’m trying to get some “seo” friendly links for an inventory section. Here is the type of link I am looking to transform:

blahh.com/detail/?numb=9795&yr=2012&make=NEWMAR&model=KING%20AIRE%204584

Basically I would like to rewrite it as

blahh.com/detail/9795/2012/NEWMAR/KING AIRE 4584 … you get the picture

Here is my .htaccess command which is not currently working. I’m sure I am doing something wrong here…

Options +FollowSymLinks
RewriteRule ^detail/([0-9]+)/([0-9]+)/([a-zA-Z]+)/([a-zA-Z]+)/$ detail/?numb=$1&yr=$2&make=$3&model=$4

By the way, this is through Wordpress. Any help would be much appreciated!

k9k,

I can see two things:

  1. You’ve not shown your test URI which I believe does not have a trailing /

  2. Your fourth atom does not accommodate the use of spaces in the model name (nor digits)

You might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, tYou might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too.

Regards,

DK

I’ve read through your notes, but it still seems messed up. I even used a dot operator as the last regex match to capture everything. Here is my whole .htaccess (with Wordpress stuff included)


# 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

#Begin SEO Friendly URLs
Options +FollowSymLinks

RewriteRule ^detail/([0-9]+)/([0-9]+)/([a-zA-Z]+)/([.]+)/$ detail/?numb=$1&yr=$2&make=$3&model=$4

kos,

Move your RewriteRule before the WP code (and REMOVE THE :kaioken: <IfModule> WRAPPER!)

Regards,

DK