HTACCESS URL rewriting problem
-
Hi everyone. I’m hoping someone with some htaccess & url rewriting expertise can help me out on this one. I’m on a shared hosting plan and am trying to rewrite some URLs on a wordpress install. I’ve got it working perfectly on a local windows XAMPP install, but the rewrite rule causes a server error when I use it on my remote server. The remote and local sites are exact mirror copies of each other, so I can’t, for the life of me, figure out the problem. Here’s my htaccess file:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / #REWRITE AFFILIATE URLs RewriteRule ^bounce/([0-9A-Za-z-]*)/([0-9A-Za-z-]*)$ wp-content/themes/theme-directory/bounce.php?c=$1&l=$2 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
I’m using this to redirect affiliate link clicks. So, the user clicks on an affiliate link such as “https://sitename.com/lowermybills/refinance” and it rewrites that url to “wp-content/themes/theme-directory/bounce.php?c=lowermybills&l=refinance”. The bounce.php script decides where to send the visitor based on the query parameters. Like I said, it’s working flawlessly on a local XAMPP install, but not on lunarpages.
Other Things I’ve Tried:
-Tried to move the bounce.php file out of the theme directory and into the site root, but ended up with the same exact problem.
-Tried to use the bounce.php file as a wordpress page template, then created a page with page slug “/bounce/” and changed the rewrite rule from bounce.php?… to bounce/?…, but that didn’t work either.
-Through all my testing, it doesn’t appear to be a WordPress issue, but rather an issue with the rule itself, hence the 500 error code rather than a 404.Thanks in advance for any ideas!
*Note: I know enough to come up with the above rule myself, but am certainly no expert with url rewriting so go easy on me if I totally have it messed up.
- The topic ‘HTACCESS URL rewriting problem’ is closed to new replies.