Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Assigning Parameters
PostPosted: Mon Dec 21, 2015 11:13 am 
Offline
Newbie

Joined: Mon Dec 21, 2015 11:08 am
Posts: 4
Hi, how to assign a parameter please for my web pages?

For example I have this landing page http://MYDOMAIN.com/lp/0010/index.html
and I want to be able to access it by assigning a paremeter
to it.

E.g. http://MYDOMAIN.com/?key=293

Meaning that both pages will lead to same web page.

Thanks


Top
   
 Post subject: Re: Assigning Parameters
PostPosted: Mon Dec 21, 2015 12:53 pm 
Offline
Linode Staff

Joined: Mon Sep 29, 2014 4:47 pm
Posts: 90
Twitter: FelicianoTech
That all depends on the software you are using to run your website. If it's custom code from a scripting language, you need to access the environment variables to get the parameter. For example in PHP you would use $_GET['key'].

If you are using a CMS such as WordPress or Drupal, I would refer to their documentation. Both have plugin support so you may find one that has this functionality already.

If this is a one-off scenario for you, you may also be able to do it in your web server's virtual host file.


Top
   
 Post subject: Re: Assigning Parameters
PostPosted: Mon Dec 21, 2015 2:25 pm 
Offline
Newbie

Joined: Mon Dec 21, 2015 11:08 am
Posts: 4
Thanks for your fast response :)

It's custom code from a scripting language.

How to access please the environment variables to get the parameter. (In PHP use $_GET['key'].)

Actually you're spot on!

Want to implement this:
Code:
<?php 
 
session_start();
 
$self = "{$_SERVER['PHP_SELF']}?{$_SERVER['QUERY_STRING']}";
 
if(!empty($_GET['key']) &&  $_GET['key'] == "9288" )  {
    unset($_GET['key']);
    $qs = http_build_query($_GET);
    $self = "{$_SERVER['PHP_SELF']}?{$qs}";
    $_SESSION['key'] = 1;
    header("Location: $self");
    exit;
} elseif (!isset($_SESSION['key'])) {
    header('Location: https://ppcmode.com');
    exit;
}
 
 
session_unset();
    session_destroy();
    session_write_close();
include("lander.php");


To make the script show the correct page you have to append the url parameter key to the end. So for example https://ppcmode.com?key=9288
The key would be set and the correct landing page would load. The visitor however would only see: https://ppcmode.com in their browser.


Top
   
 Post subject: Re: Assigning Parameters
PostPosted: Mon Dec 21, 2015 2:36 pm 
Offline
Linode Staff

Joined: Mon Sep 29, 2014 4:47 pm
Posts: 90
Twitter: FelicianoTech
I'm confused. Did you find your answer? Or do you still have a question/issue?


Top
   
 Post subject: Re: Assigning Parameters
PostPosted: Mon Dec 21, 2015 2:38 pm 
Offline
Newbie

Joined: Mon Dec 21, 2015 11:08 am
Posts: 4
Well to apply this code first I need the following get down which I have no idea how to?

How to assign a parameter please for my web pages?

For example I have this landing page http://MYDOMAIN.com/lp/0010/index.html
and I want to be able to access it by assigning a parameter to it.

E.g. http://MYDOMAIN.com/?key=293

Meaning that both pages will lead to same web page.


Top
   
 Post subject: Re: Assigning Parameters
PostPosted: Tue Dec 22, 2015 3:46 am 
Offline
Newbie

Joined: Mon Dec 21, 2015 11:08 am
Posts: 4
Also just tried to create my landing page with php extension for another script and I get server error 500.
Why is that please? Need something changed in my server settings?


Top
   
 Post subject: Re: Assigning Parameters
PostPosted: Tue Dec 22, 2015 9:18 am 
Offline
Senior Member

Joined: Wed Oct 20, 2010 12:11 pm
Posts: 142
Check your Apache error log.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group