![]() | | ||||||||
| | #1 |
| FirebirdSEO.com War Room Member Join Date: Sep 2009 Location: Phoenix, AZ
Posts: 285
Thanks: 3
Thanked 51 Times in 34 Posts
| ** The first person to post the solution to this, I'll PM you to get your Paypal address and I'll send you $5 QUESTION: I'm trying to figure out the best way to redirect a vistitor who types in my URL with a coupon code (see below) to another url with a variable populated. For example, when someone types the following: http://www.mysite.com/A101 they are redirected to: http://www.mysite.com/page.php?coupon=A101 (PREFERRED SOLUTION) or to: http://www.mysite.com where a form field is prepoulated with the A101 code so they only need to click a submit button Right now the mysite.com/A101 is treated as a 404 and I tried to do a custom PHP to get the URL using SERVER_NAME and PHP_SELF but it's just showing the 404.php page. I don't want to have to create files/directories for A101 anywhere, it needs to dynamically do it. I'm running on Apache/PHP Thanks in advance! |
| | |
| | |
| | #2 |
| HyperActive Warrior War Room Member Join Date: Aug 2009 Location: Port Charlotte, Florida
Posts: 204
Thanks: 45
Thanked 20 Times in 18 Posts
|
Jeff, When I want a browser to leave one site and go to another I just put this code in the meta tags of the index page, <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/index.html"> or whatever page you want it to go to. The zero is how many seconds you want it to wait before it switches. |
| | |
| | #3 |
| Thinker Join Date: Sep 2009 Location: Germany
Posts: 61
Thanks: 54
Thanked 9 Times in 7 Posts
|
Hi Jeff, you can also use URL rewriting to do that. (I think this would be the best solution if there are a lot of different coupon codes.) Here's how to do it: mod_rewrite: A Beginner's Guide to URL Rewriting [Apache & IIS Configuration] Trey |
| Dare to think? Join the Thinkers Club - The Collective Thought Journal (free membership and no email required for registration) MuscularBrain.com: A Perfectionist's Thoughts on Self Development | |
| | |
| | #4 | |
| FirebirdSEO.com War Room Member Join Date: Sep 2009 Location: Phoenix, AZ
Posts: 285
Thanks: 3
Thanked 51 Times in 34 Posts
| Quote:
| |
| | ||
| | |
| | #5 |
| PHP Programmer Join Date: Nov 2009 Location: /dev/null
Posts: 136
Thanks: 5
Thanked 12 Times in 12 Posts
|
Well I would with what Trey said. You could use mod_rewrite to redirect your page. Make a file called .htaccess and have the contents be: RewriteEngine on RewriteRule ^yourURL$ /page.php?coupon=yourURL [R] and whenever someone types in yoursite.com/yourURL they will be redirected to the page.php?coupon=yourURL You can see a demo by typing m4rx.com/coupon and it will so you the redirect to cat.php?coupon=coupon This is just like when companys do this. You could modify it to show R=301(Found). This is the industry standard and works well. http://en.wikipedia.org/wiki/HTTP_302 Don't use 301(Moved Permanatly) as then the URL becomes useless when crawled, and because I would rarely use it(except after major remodeling ;] ). Any help configuring it, PM me. --m4rx |
| We are what we repeatedly do. Excellence, then, is not an act, but a HABIT. ~Aristotle Bored. Check out my blog. Last edited by m4rx; 01-23-2010 at 11:33 PM. Reason: Added redirect type code | |
| | |
| | #6 |
| Customer Tools War Room Member Join Date: Dec 2009 Location: Texas
Posts: 96
Thanks: 0
Thanked 7 Times in 7 Posts
|
m4rx has the solution I would choose. unless you want to modify the php code. (which would be very easy to do)
|
| Ultimate Keyword Tool - Create HUGE Targeted Keyword Lists In Minutes Not Hours Or Days. $7 seven day trial.
| |
| | |
| | #7 |
| Warrior Member Join Date: Oct 2009 Location: Warsaw, Poland
Posts: 11
Thanks: 7
Thanked 4 Times in 3 Posts
|
Nice idea with Paypal. It might be useful sometimes...
|
| | |
| | |
| | #8 | |
| FirebirdSEO.com War Room Member Join Date: Sep 2009 Location: Phoenix, AZ
Posts: 285
Thanks: 3
Thanked 51 Times in 34 Posts
| Quote:
Thanks for pointing me in the right direction...mod rewrites seems like the way to go. I'll PM you for your Paypal address to send you the $5! - Jeff | |
| | ||
| | |
![]() |
|
| Tags |
| answer, paypal, php, question |
| Thread Tools | |
| |
![]() |