Need to get name & email before htaccess redirect

  spot the braincell 15:07 03 Jul 08
Locked

Following on from my previous post to redirect my domain to an affiliate site to which I've subscribed I sucessfully did a 301 redirect after Kemistri's instructions (thanks).

Prior to the redirect I want to ask all visitors for their name and email but can't work out how to do it.

I have some code which I plan to name subscribe.html which will ask for the name and email but I don't know if I can use it as the .htaccess file on my domain sends all visitors straight to the affiliate site.

Is there anyway I can get hold of visitor information before they disappear off to the affiliate site, a site over which I have no control.
cheers

  Forum Editor 18:48 03 Jul 08

sends all visitors straight to the affiliate site."

Why?

You can tell .htaccess to send people to any page you like, it doesn't have to waft them off to a different site.

If you would like to send people to a page called say, subscribe.html you can do it. Just use a directory index. A directory index is a command that allows you to specify a default page that loads whenever someone types www yoursite .com (I've included spaces to prevent a 'click here' hyperlink forming). Instead of seeing your index file your visitors will see the page you want them to see.

If you put the line:

DirectoryIndex subscribe.html

in your htaccess file and your visitors will go to that page. Once they're there you can ask them to subscribe, and then get the subscription form to take them off to your affiliate site when the submit button is clicked.

  Kemistri 19:27 03 Jul 08

It sounds like you opted for the htaccess 301 from the link (click here) that I gave you the other day. I think you should be able to achieve what you want using the FE's suggested method by incorporating a PHP 301 into your form processing script, triggered by the form action exactly as the FE described. The PHP code for that is at that link, about half way down the page.

  spot the braincell 20:45 03 Jul 08

Thanks guys, I'll check out your advice and give it a go, hopefully tomorrow - I may be back!

  spot the braincell 13:19 08 Jul 08

well I am back,

I've done the following
1) setup .htaccess as suggested it reads
DirectoryIndex subscribe.html

2) subscribe.html is the mailing list code as provided by my host heartinternet and is supplied with a redirect which I've told it to be a file called complete.html

3) complete.html holds the PHP 301 redirect code as follows
<?php
header( "HTTP/1.1 301 Moved Permanently" );
header( "Status: 301 Moved Permanently" );
header( "Location: http: //www my affiliate site com/" );
exit(0);
?>

It works to an extent, I get prompted to subscribe and enter an email address. However the address bar then displays mywebsite/complete.html in the address bar but that's it, just a blank white page below, whereas according to my plan it should run the PHP redirect as shown in step 3)

I've tried replacing complete.html with a new file complete.php which holds the same php redirect code as the .html but that creates a problem with a list.cgi file at heartinternet.

Any ideas welcome
thanks

This thread is now locked and can not be replied to.

Nintendo Switch review: Hands-on with the intuitive modular console and its disappointing games…

1995-2015: How technology has changed the world in 20 years

This abstract video touches on division in our technologic world

Best alternatives to iTunes for Mac | Best music players for macOS: Free your music from the…