$10 for solving my Redirect Issue

Status
Not open for further replies.

PSU4Life

New member
Aug 10, 2006
306
4
0
1st person to post the correct code for my .htaccess file gets $10 via paypal.

I'm trying to get my affiliate links to look like (domain .com/go/offer) I've followed the insructions layed out at How To Hide All Your Affiliate Links With Only One File » DerekBeau.com but i can't get it to work on my wordpress blog. Apparently using custom permalinks messes things up but adding a [L] after every RewriteRule is supposed to fix it. But even with using [L] I get the same error. I must be messing something up when I add the Rewrite rule before the wordpress code.

My current .htaccess file looks like:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


The blog post says I need the below code to come before the wordpess code.

RewriteEngine On
RewriteRule go/(.*)/$ /go/index.php?title=$1 [L]


What should my total .htaccess file look like?

Thanks
 


Code:
RewriteEngine On

RewriteRule go/(.*)/$ /go/index.php?title=$1 [L]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
if u're still having problems then it's probably your index.php in the go folder. also keep in mind his rewrite rule is assuming a trailing forward slash after the name of the offer (i.e. go/azoogle/) so make sure your linking with the trailing slash otherwise that rule won't trigger and it'll fall over to the wordpress rule after.
 
  • Like
Reactions: PSU4Life
My solution:
See: WordPress › Support » .htaccess and subdirectories

Also do the 403 error, as described.
Code:
ErrorDocument 401 /path/to/onerror.html
ErrorDocument 403 /path/to/onerror.html

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule go/(.*)/$ /go/index.php?title=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

DO make sure the lines go at the top of the .htaccess file. They go before any of the rewrite code (even turning it on).

DO make sure you create the onerror.html file and only have the following in it:
Code:
<html></html>
DO make sure you modify the FULL PATH of the error document lines... :-)

One guy said it didn't work for him, but the OP said it did. I've had it work also.

BTW, this is strictly telling Apache how to deal with the certain prompts, but really has nothing to do with WP, other then preempting WP trying to rewrite...

PM me for paypal, if it works. ;-)

Also, you may try taking the following line out:
Code:
RewriteRule go/(.*)/$ /go/index.php?title=$1 [L]
Put this in the .htaccess in your /go/ directory:
Code:
RewriteEngine On
RewriteRule /go/(.*)/$ index.php?title=$1 [L]

Not 100% on THAT code, but handle the GO rewrite in the /go/ directory.

Oh, and when you update Wordpress, make sure to NOT delete the onerror.html file... :-)
 
Thanks, got it working now.

I'll send you both $10 for your help via paypal. PM your paypal email.

Thanks
 
Status
Not open for further replies.