• I’m having a little touble with mod_rewrite… I’m trying to create pretty permalinks for blog post, but in addition to those, add a custom permalink for my dynamic queries- here’s the sample:

    from: https://www.mysite.com/?id=3&mls=183343
    to: https://www.mysite.com/mls/183343.php

    Options FollowSymLinks
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_REFERRER} !^www\.mysite\.com/?id=3&mls=([^/]+)
    RewriteRule ^mls/([^/]+)/$ /index.php?id=3&mls=$1 [L,NC]
    </IfModule>
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    Strange thing (and this is why I think this may be a wordpress issue), anywhere I see the ‘$1’ variable within the body of my page (in my case, a 6 digit MLS number), it adds whatever is added after those numbers in the address bar – example: if I add 183383.php, it will add a ‘.php’ to those 6 digits within the body of the site – extremely problematic. The same applies with ‘.html’. Plus, it adds a trailing slash in the address bar (after the suffix). This may be an easy fix; I’m new to mod_rewrite. That being said, I’m assuming that any portion of my .htaccess code could be conflicting with my ultimate goal, as well as something within WP. Any help would be appreciated! Thanks!

  • The topic ‘Custom Mod_Rewrite – possible wordpress conflict?’ is closed to new replies.