Forum Moderators: phranque

Message Too Old, No Replies

Why doesn't this work?

.htaccess

         

Snyder

3:58 am on Oct 12, 2010 (gmt 0)

10+ Year Member



Options +FollowSymlinks
RewriteEngine on
RewriteRule ^aff_c?offer_id=([0-9]+)&aff_id=([0-9]+) http://www.lazyprofits.com/?o=$1&a=$2 [NC]


[lazyprofits.com...]

sublime1

4:06 am on Oct 12, 2010 (gmt 0)

10+ Year Member



Hi Snyder --

Welcome to WebmasterWorld! Please check the forum charter, as I think posting real URLs is disallowed.

If you take a minute to read some of the guidelines, you'll also see that good descriptive subjects, a little bit of description of the problem, your context, what does and doesn't work with examples will all help the people who monitor these boards do a good job answering your question in a way that can not only help you, but also others who are searching for the same problem in the future.

I was tempted to respond "It works fine for me." :-)

You'll get what you give, if you know what I mean...

Tom

Snyder

5:07 am on Oct 12, 2010 (gmt 0)

10+ Year Member



I only posted the URL as proof that it wasn't working for me.
It's not rewriting the URL as it should, should redirect me to: [lazyprofits.com...]

g1smd

6:07 pm on Oct 12, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



RewriteRule cannot "see" query strings. You need a preceding RewriteCond looking at QUERY_STRING to match with instead.

You mentioned rewrite and redirect in the question. Which one do you want? They are different things.

Your current code gives a 302 redirect as you didn't clarify by using the [R=301,L] flags.

The L flag must be added, unless you know exactly why you would want to omit it.

jdMorgan

5:24 pm on Oct 15, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




Options +FollowSymlinks
RewriteEngine on
#
RewriteCond %{QUERY_STRING} ^offer_id=([0-9]+)&aff_id=([0-9]+) [NC]
RewriteRule ^aff_c$ http://www.lazyprofits.com/?o=%1&a=%2 [NC,R=302,L]

Coded as a redirect, because I assume that you want to redirect the client instead of just silently rewriting the originally-requested URL to a script filepath.

Coded as a 302 redirect, because I assume that you want search engines to "keep" the original URL.

If either assumption is wrong, then so is the code.

Jim