SEO Rewrite Rule w/Wordpress

Hey everyone. I’m having trouble getting my URL Rewriting to work with Wordpress. I currently have a bit of an odd structure as it is, so hopefully someone can help me out. Here is the site:

http://hippo.arvixe.com/~bgmh1986/site/inventory/

Basically, taking the first entry as an example, I’d like the details page to rewrite to this:

http://hippo.arvixe.com/~bgmh1986/site/detail/9747/2012/NEWMAR/VENTANA LE

However, no matter how I seem to structure my .htaccess file, it doesn’t seem to want to work. Here is what I have so far:


RewriteEngine On
RewriteBase /~bgmh1986/site/
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~bgmh1986/site/index.php [L]

Options +FollowSymLinks
RewriteRule inventory/([0-9]+)/([0-9]+)/[A-Z][a-z]*/[A-Z][a-z]*/$ /detail.php?numb=$1&yr=$2&make=$3&model=$4

Any help would be much appreciated. I feel like WP may be overwriting something (the top rules were generated automatically by WP).

9k,

Strange to see a WP mod_rewrite with an actual RewriteBase statement that does something! That said, I’d move ALL the mod_rewrite to the site directory and remove the RewriteBase and path from the RewriteRule because the RewriteBase directive is designed to undo a mod_alias redirection and has the effect of making a jumble out of mod_rewrite logic.

Now, for your problem (the last two lines), you can delete the Options line as it’s already enabled in the server’s configuration file (else WP’s code wouldn’t work). THEN, because you’re being very specific in your second RewriteRule, move it where the RewriteBase statement is located so WP doesn’t redirect everything to its index file handler. In fact, I’d KEEP that in the DocumentRoot’s .htaccess and add back the ~/site path in the regex’s path.

KEEP everything logically separated then do a “walk through” of your code as you traverse the path to the file requested. In what you’ve shown, your inventory/{file} request is matched by the . and redirected to index.php. If you make the changes I recommended above, it would be redirected in the DocumentRoot to detail (in the DocumentRoot) and the WP mod_rewrite code would never see it.

Regards,

DK