Go Back   WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 10-20-2009, 03:40 AM   #1
HyperActive Warrior
War Room Member
 
Join Date: Mar 2009
Location: Germany
Posts: 164
Thanks: 218
Thanked 32 Times in 27 Posts
Default forced redirect with mod_rewrite in htaccess?

Hi fellow warriors,

I'm not quite sure how to proceed with a tracking script which uses a mod_rewrite with htaccess.

For each link I want to track, the script gives me a URL like www.mydomain.com/recommends/XXX.

The paths and directories are set up ok, mod_rewrite is enabled. The htaccess-code which came with the script is as follows:

Code:
RewriteEngine on 
RewriteBase /recommends
RewriteRule ^/?(.*) /go/go.php/$1 [QSA]
When I put this as .htaccess into the "recommends" directory, I get an error message which says something like "no input file specified".

By trial and error, I found that when I change the last line to

Code:
RewriteRule ^/?(.*) /go/go.php/$1 [R,QSA]
everything is working just fine.

Now, what I don't understand:

  • Why do I have to enforce the redirect with the additional "R"?
  • If I add "R", although the programmer originally hadn't included it, could I run into any trouble?
  • Should I use "R=301" (permanently moved) or "R=302" (temporarily moved) for a tracking script? I only want to get some data about which adds convert better than others...
  • Oh, and should I include an L tag at the end of the last line, too?
Sorry for the beginner's questions. I've been searching for several hours now, and there is a ton of info about mod_rewrite, but nothing really answers my questions -- guess they are just too basic...

Any help appreciated,

milkyway

Blog and newsletter owners:
Publish quality articles by Dr. Mani
- for free -

Never miss an opportunity to be fabulous.
milkyway is offline   Reply With Quote
Old 10-24-2009, 11:54 AM   #2
Warrior Member
 
Join Date: Oct 2009
Location: Nashville, TN - Costa Rica
Posts: 12
Thanks: 0
Thanked 2 Times in 2 Posts
Social Networking View Member's Myspace Profile  View Member's FaceBook Profile  View Member's Twitter Profile 
Contact Info
Send a message via ICQ to munkyscripts Send a message via AIM to munkyscripts Send a message via MSN to munkyscripts Send a message via Yahoo to munkyscripts
Default Re: forced redirect with mod_rewrite in htaccess?

Not sure but an alternate way to track the clicks is to use js. this is code i use.
Code:
<script language="JavaScript" type="text/javascript"> 
<!-- 
function trackclick(id) {
if(document.images){ 
    (new Image()).src="/wp-content/plugins/munkytoplist/out.php?id="+id;
} 
return true;
}
// --> 
</script>
Then in the a href i add onclick="return trackclick('1');" where 1 is the id of whatever you are tracking

munkyscripts is offline   Reply With Quote
Old 10-24-2009, 02:35 PM   #3
HyperActive Warrior
War Room Member
 
Join Date: Mar 2009
Location: Germany
Posts: 164
Thanks: 218
Thanked 32 Times in 27 Posts
Default Re: forced redirect with mod_rewrite in htaccess?

Hi munkyscripts,

thanks for your answer!

I already have a tracking script which allows me to track what I need and displays everything very nicely. It's based on JavaScript, too, but does some other fancy stuff which I couldn't program myself.

I was just wondering about how to proceed with the mod_rewrite, in particular if I can mess anything up when I add "R" and "L" tags, and if I should use temporarily or permanently moved redirects.

As I said, I'm new to this htaccess stuff and am just not sure how to proceed...

Thanks for your help -- much appreciated,

milkyway

Blog and newsletter owners:
Publish quality articles by Dr. Mani
- for free -

Never miss an opportunity to be fabulous.
milkyway is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk

Tags
forced, htaccess, modrewrite, redirect

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 04:23 AM.