Page 2 of 2 First 12
  • Jump to page:
    #16
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Location
    Glendale AZ
    Posts
    188
    Rep Power
    93
    Originally Posted by Kravvitz
    Code:
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    RewriteRule ^\/?view_event.asp$ http://www.backprint.com/view_event.asp [R=301,L,NC,QSA]
    
    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    RewriteRule ^\/?(index\.php|storefront\.asp|default\.asp)?$ http://www.backprint.com/storefront.asp?PID=bp%13~Gu [R=301,NC,NE]
    I keep forgetting to ask if my addition of index\.php is proper in the second rewrite rule?

    Ideally, the first rule should forward any events and the second would actually redirect ANY other URL, not just index, storefront, or default. I tried to modify it to ^\/?$ which from my little googling means ^ (start the comparison) \/ (an escaped /) ? (makes the / optional) and $ (end). Am I understanding it correctly and will that work and is there some reason that I don't know of to NOT do it that way?

    On that new version for the event it's converting the %13 to %2513 as it has with a couple other variations.

    On the storefront it's not escaping at all "http://www.backprint.com/storefront.asp?PID=bp3~Gu".

    Are these always this frustrating? Thanks again for taking the time to help.
    Last edited by big0mike; February 18th, 2013 at 05:34 PM.
  2. #17
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,127
    Rep Power
    4304
    I keep forgetting to ask if my addition of index\.php is proper in the second rewrite rule?
    It's correctly done.

    I tried to modify it to ^\/?$ which from my little googling means ^ (start the comparison) \/ (ab escaped /) ? (makes the / optional) and $ (end).
    Yes, but that will only redirect requests that don't specify a file name or path, which isn't what you want.

    Are these always this frustrating?
    Often but not always.

    Try the following. If it doesn't work, try removing the ",NE". (If it still doesn't work, we'll have to try using a PHP script to handle the redirect.)
    Code:
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    RewriteRule ^\/?view_event.asp$ http://www.backprint.com/view_event.asp [R=301,L,NC,QSA]
    
    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    RewriteRule ^\/?(index\.php|storefront\.asp|default\.asp)?$ http://www.backprint.com/storefront.asp?PID=bp%2513~Gu [R=301,NC,NE]
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  4. #18
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Location
    Glendale AZ
    Posts
    188
    Rep Power
    93
    Nope, neither worked

    So, I thought initially, I can get a PHP script to do what I need. But then it occurred to me that I can take a URL and redirect it but the problem is that I don't know what the incoming URL would be. Whatever that URL is it will likely redirect to a 404 page because the page, likely one of the events, will not exist on my server.

    So, I'm thinking that I need to work with the 404 page to figure out what URL was requested. If it's an event page, redirect to ...viewevent.asp... If it's the root document redirect to my storefront. Anything else, continue on with the 404 error page.

    Am I thinking along the right lines or totally missing the obvious and easy way?
  6. #19
  7. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,127
    Rep Power
    4304
    You could use the 404 page, but that's not what I had in mind. I would suggest using a PHP script in conjunction with mod_rewrite.

    Code:
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    RewriteRule ^\/?view_event.asp$ http://www.backprint.com/view_event.asp [R=301,L,NC,QSA]
    
    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    RewriteRule ^\/?(index\.php|storefront\.asp|default\.asp)?$ bp-redirect.php [NC]
    Code:
    <?php
    header("HTTP/1.1 301 Moved Permanently");
    $new_url='http://www.backprint.com/storefront.asp?PID=bp%13~Gu';
    header('Location: '.$new_url);
    
    echo 'Redirecting to <a href="'.$new_url.'">'.$new_url.'</a>.';
    ?>
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo