Simple Modrewrite Php (and A Small Donation)

Discussion in 'Apache' started by tomupton, Feb 3, 2013.

  1. #1
    Hi There,

    I have a .htaccess file that is passing a value through to a page.

    This is the file:
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.php -f
    RewriteRule ^(.*)$ $1.php

    RewriteEngine on
    RewriteRule ^([^/\.]+)/?$ page.php?seo_link=$1

    My database stores a value called "seo_link" so when someone visits the page it displays like this - http://www.mysite/seo-link

    I have a varible i need to pass within this .htaccess file but i dont want it to display on the url above.

    The field within the database is called "treatment_id" and this needs to be hidden.

    I am happy to make a small paypal donation to someone who can help me!

    Regards

    Tom
     
    tomupton, Feb 3, 2013 IP
  2. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #2
    At one time Nimrod had an excellent tutorial on this site about the voodoo known as mod rewrite. A little searching might find your answer for free.

    I can do the simple stuff but what you want might take time to figure out.
     
    Last edited: Feb 3, 2013
    Colbyt, Feb 3, 2013 IP
  3. ryan_uk

    ryan_uk Illustrious Member

    Messages:
    3,983
    Likes Received:
    1,022
    Best Answers:
    33
    Trophy Points:
    465
    #3

    I don't exactly get it. You want a variable passed called treatment_id, but for it to NOT be in the URL?

    So the URL click would be example.com/seolink and what you want directed to the script is seolink?treatment_id=123 (as an example). Without 123 being in the URL, how is it supposed to be passed? Or is treatment_id either 1 or 0 depending upon the URL? For example, 1 if it's example.com/seolink and 0 if it's example.com?

    PS: If I do help you, please no donation - I'm doing it for free. :)
     
    ryan_uk, Feb 5, 2013 IP
  4. cesurasean

    cesurasean Active Member

    Messages:
    269
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #4
    You could set this up using DNS maybe. Only way to do this would be to mask the address, AND use the variable. You can't pass along the variable, unless it's in the address..... So, example would be test.whatever.com leads to testcom/seolink?whatever=good&blah=yeah), so the user will only see test.whatever.com. Otherwise, why would you want to hide the variable? Also, you can try to encrypt the variable if it's an concern when being viewed.
     
    cesurasean, Feb 19, 2013 IP
  5. innozemec

    innozemec Active Member

    Messages:
    84
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    68
    #5
    is the treatment_id variable static or changing for each url? If it is changing there's no way to hide it..
     
    innozemec, Feb 19, 2013 IP