Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2011
    Location
    Sunshine State
    Posts
    80
    Thanks
    18
    Thanked 0 Times in 0 Posts

    mod_rewrite with string variable

    I don't even think I have the topic title right...it's almost no wonder I'm lost

    the long and short is I need to have a single landing page that will be branded with each affiliate's banner...when I present this to them tomorrow, I want to be able to say "ok guys...all you need to do is send your agents to http://domain.com/affiliateshortname/carrier" so that they can download whatever documents they need

    in so many tutorials this is demonstrated as something like:
    RewriteRule ^[A-Za-z]/heartland/quick-quote.html$ /heartland/index.php?affiliateID=$1 [L]

    and then I'll be able to get the appropriate header banner to display based on affiliateID

    how can I get [A-Za-z] turned into $1 I think is what I'm asking

    as always any help is greatly appreciated

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    This hasn't a thing to do with PHP, moving to apache configurations.
    Wrap the [A-Za-z] in brackets. PHP will then be provided an affiliateID of that value found in the $_GET superglobal.

  • #3
    New Coder
    Join Date
    Jul 2011
    Location
    Sunshine State
    Posts
    80
    Thanks
    18
    Thanked 0 Times in 0 Posts
    thanks for getting me in the right topic

    ok so then I did have it kind of right...now I'm just getting 404 errors

    the actual link that I will be providing my guys is http://mynsga.com/aam/heartland/quick-quote.html (aam is one of the affiliate short names) - I have tried to access it by typing that url in the address bar and by clicking on a link (<a href="/aam/heartland/quick-quote.html">blah</a>) and they both generate a 404 error

    so this is what I have in my .htaccess:
    Code:
    ErrorDocument 400 /includes/config.php
    ErrorDocument 401 /includes/config.php
    ErrorDocument 403 /includes/config.php
    ErrorDocument 404 /includes/config.php
    ErrorDocument 500 /includes/config.php
    
    RewriteEngine on
    RewriteRule ^[A-Za-z]/heartland/quick-quote.html$ /heartland/index.php?affiliateID=$1 [L]
    is it possible that mod_rewrite isn't available to me? could someone tell me what I need to look for in my phpinfo() to see if it's enabled? if it's not enabled then all of this is an exercise in futility as I don't have access to the httpd.conf file or whatever (although it's good stuff to learn anyway )

    thanks in advance for your help

    EDIT: just wanted to add that according to GoDaddy:
    Mod_rewrite is an Apache Web server module installed on all of our Linux servers by default; it does not have to be installed or enabled. Our Linux hosting accounts support most mod_rewrite functions.
    Last edited by dnnhater; 10-12-2011 at 05:04 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •