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

    Join Date
    Apr 2007
    Location
    Glendale AZ
    Posts
    188
    Rep Power
    93

    Domain forwarding question


    I've got a domain wideopenevents.org.

    I use a photo print & fulfillment service where my home directory is backprint.com/wideopenevents.

    I used GoDaddy's domain forwarding with masking to redirect wideopenevents.org to backprint.com/wideopenevents.

    No problems there. The problem is this: for some of the events I'll be photographing there will be a link that points to:

    http://backprint.com/view_event.asp?PID=bp%13~Gu&EVENTID=112859

    This will be a direct link to this gallery so that the athletes don't have to wade through a list of events to find theirs.

    Problem is with the forwarding wideopenevents.org/view_event.asp?PID=bp%13~Gu&EVENTID=112859

    translates into backprint.com/wideopenevents/view_event.asp?PID=bp%13~Gu&EVENTID=112859

    with the extra wideopenevents in there being unnecessary.

    So what I need to know is is it possible to direct any traffic to the root wideopenevents.org to backprint.com/wideopenevents while redirecting any requests for anything other than the root of wideopenevents to backprint.com/WhatEverTheRemainingURLIs while still masking the fact that the user is on backprint.com?

    I hope that's clear. I think it is but I know absolutely nothing about these types of redirects, let alone how to do it the oddball way I need it done. Any help would be appreciated.

    Thanks,

    Mike
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,131
    Rep Power
    4304
    backprint.com seems to be using IIS, not Apache.

    One solution might be to create a "view_event.asp" file in your directory that redirects to the correct URL.
    Last edited by Kravvitz; February 14th, 2013 at 12:12 PM. Reason: moved the thread back to Apache
    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. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Location
    Glendale AZ
    Posts
    188
    Rep Power
    93
    Originally Posted by Kravvitz
    backprint.com seems to be using IIS, not Apache.

    One solution might be to create a "view_event.asp" file in your directory that redirects to the correct URL.

    *** Thread Moved ***
    I have NO control over backprint.com. I do control my domain which is through HostGator running Apache. That's where I wanted the mod_rewrites to happen.

    I was hoping to have some kind of rewrite that said:

    wideopenevents.org > backprint.com/wideopenevents
    and
    wideopenevents.org/anyotherurl > backprint.com/anyotherurl

    Apparently, there's not much help to be had about this but can we move it back to the original location?
  6. #4
  7. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,131
    Rep Power
    4304
    It sounds like you'll need to change how you have the forwarding set up. The initial web server is also running IIS, but it's a different version from what backprint.com is using. (GoDaddy has both Apache and IIS servers.)

    Are you aware that three redirects are occurring when you go directly to http://wideopenevents.org/ the first time? The good thing is that you should be able to use just one.

    First of all you create a file called ".htaccess" (not ".htaccess.txt") with the following contents and upload it to (the web-root of) your HostGator server:
    Code:
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    RewriteRule ^\/?view_event.asp$ http://www.backprint.com/view_event.asp?PID=bp%13~Gu [L,NC,QSA]
    
    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    RewriteRule ^\/?(storefront\.asp|default\.asp)?$ http://www.backprint.com/storefront.asp?PID=bp%13~Gu [NC,QSA]
    Then you go into your GoDaddy control panel and remove the redirect and change your DNS settings to point to your HostGator server.

    [...] while still masking the fact that the user is on backprint.com?
    It does not seem to be masking the domain currently. Masking (without very problematic frames) is more complicated than what I outlined above.
    Last edited by Kravvitz; February 14th, 2013 at 12:40 PM.
    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).
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Location
    Glendale AZ
    Posts
    188
    Rep Power
    93
    Originally Posted by Kravvitz
    It sounds like you'll need to change how you have the forwarding set up.
    I removed the masking at GoDaddy and just had it forward wideopenevents.org to backprint.com/wideopenevents

    Originally Posted by Kravvitz
    Are you aware that three redirects are occurring when you go directly to http://wideopenevents.org/ the first time? The good thing is that you should be able to use just one.
    No, I wasn't.

    Code:
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    RewriteRule ^\/?view_event.asp$ http://www.backprint.com/view_event.asp?PID=bp%13~Gu [L,NC,QSA]
    
    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    RewriteRule ^\/?(storefront\.asp|default\.asp)?$ http://www.backprint.com/storefront.asp?PID=bp%13~Gu [NC,QSA]
    Now, as you know, I don't know anything about the rewrites. So, I want to figure out what's happening. Both to make sure it's what I need and so I actually learn something

    Code:
    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    That's just checking the domain?

    Code:
    ^\/?view_event.asp$
    This is checking if an event is being viewed? If so foward to here:
    Code:
    http://www.backprint.com/view_event.asp?PID=bp%13~Gu [L,NC,QSA]
    Code:
    ^\/?(storefront\.asp|default\.asp)?$
    This is checking if the storefront is being viewed? If so forward to here:
    Code:
     http://www.backprint.com/storefront.asp?PID=bp%13~Gu [NC,QSA]
    Close?

    The storefront part is correct. The event is always going to vary so it needs to know the &EVENTID requested and add that to the end. I don't see that happening but don't know what L,NC,QSA means.
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Location
    Glendale AZ
    Posts
    188
    Rep Power
    93
    Hit submit before I did any searching. QSA adds the query string. I'm not sure I understand exactly how it works but that looks like it will do the job. I'll give it a try...
  12. #7
  13. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,131
    Rep Power
    4304
    Sure, you didn't intentionally have that many redirects. I'll show you the headers, so you can see for yourself. (I removed some of the unimportant bits.) I should point out that trailing slashes are important (when you're not linking to a specific file) -- if you leave them out, servers will usually respond with a redirect.
    Code:
    http://wideopenevents.org/
    
    GET / HTTP/1.1
    Host: wideopenevents.org
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.4) Gecko/20130122 Firefox/15.4.1 PaleMoon/15.4.1
    
    HTTP/1.1 301 Moved Permanently
    Content-Type: text/html
    Location: http://www.backprint.com/wideopenevents
    Server: Microsoft-IIS/7.5
    X-AspNet-Version: 4.0.30319
    X-Powered-By: ASP.NET
    Date: Thu, 14 Feb 2013 20:39:34 GMT
    Content-Length: 0
    ----------------------------------------------------------
    http://www.backprint.com/wideopenevents
    
    GET /wideopenevents HTTP/1.1
    Host: www.backprint.com
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.4) Gecko/20130122 Firefox/15.4.1 PaleMoon/15.4.1
    
    HTTP/1.1 301 Moved Permanently
    Content-Length: 163
    Content-Type: text/html
    Location: http://www.backprint.com/wideopenevents/
    Server: Microsoft-IIS/6.0
    X-Powered-By: ASP.NET
    ----------------------------------------------------------
    http://www.backprint.com/wideopenevents/
    
    GET /wideopenevents/ HTTP/1.1
    Host: www.backprint.com
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.4) Gecko/20130122 Firefox/15.4.1 PaleMoon/15.4.1
    
    HTTP/1.1 302 Object moved
    Date: Thu, 14 Feb 2013 20:42:57 GMT
    Server: Microsoft-IIS/6.0
    X-Powered-By: ASP.NET
    Location: /storefront.asp?PID=bp%13%7EGu
    Content-Length: 151
    Content-Type: text/html
    ----------------------------------------------------------
    http://www.backprint.com/storefront.asp?PID=bp%13%7EGu
    
    GET /storefront.asp?PID=bp%13%7EGu HTTP/1.1
    Host: www.backprint.com
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.4) Gecko/20130122 Firefox/15.4.1 PaleMoon/15.4.1
    
    HTTP/1.1 200 OK
    Date: Thu, 14 Feb 2013 20:42:57 GMT
    Server: Microsoft-IIS/6.0
    X-Powered-By: ASP.NET
    Content-Length: 18607
    Content-Type: text/html
    That's just checking the domain?
    Yes. I saw that you're using at least two domains, so I added that. (Presumably you're using a single host for both.)
    This is checking if an event is being viewed? If so foward to here:
    Not exactly. The "QSA" flag means that the query string from the first request will be appended to the redirect URL. The "NC" flag makes the match be case-insensitive. The "L" flag means if this rule matched, then don't process any more RewriteRule directives.
    This is checking if the storefront is being viewed? If so forward to here:
    It checks if the URL is "http://wideopenevents.org/", "http://wideopenevents.org/storefront.asp", or "http://wideopenevents.org/default.asp" (regardless of if there is query string or not).

    I forgot to set the "R" flag to specify that it's permanent redirect (instead of a temporary one):
    Code:
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    RewriteRule ^\/?view_event.asp$ http://www.backprint.com/view_event.asp?PID=bp%13~Gu [R=301,L,NC,QSA]
    
    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    RewriteRule ^\/?(storefront\.asp|default\.asp)?$ http://www.backprint.com/storefront.asp?PID=bp%13~Gu [R=301,NC,QSA]
    Last edited by Kravvitz; February 14th, 2013 at 04:07 PM.
    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).
  14. #8
  15. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Location
    Glendale AZ
    Posts
    188
    Rep Power
    93
    Originally Posted by Kravvitz
    It checks if the URL is "http://wideopenevents.org/", "http://wideopenevents.org/storefront.asp", or "http://wideopenevents.org/default.asp" (regardless of if there is query string or not).
    Will a leading www. on the url make a difference? I don't type if often anymore but I'm sure some people do.

    Thank you very much for the help!
  16. #9
  17. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,131
    Rep Power
    4304
    You're welcome.

    Good question. No, it won't make a difference. Either will work.

    If I had added a "^" to the beginning of the expression, it would not work with "www.wideopenevents.org":
    Code:
    RewriteCond %{HTTP_HOST} ^wideopenevents\.org$ [NC]
    To explicitly check for subdomains (but not require one), you could use this:
    Code:
    RewriteCond %{HTTP_HOST} ^([a-z]+\.)*wideopenevents\.org$ [NC]
    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).
  18. #10
  19. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Location
    Glendale AZ
    Posts
    188
    Rep Power
    93
    So this is my .htaccess file:
    Code:
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    RewriteRule ^\/?view_event.asp$ http://www.backprint.com/view_event.asp?PID=bp%13~Gu [R=301,L,NC,QSA]
    
    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    RewriteRule ^\/?(storefront\.asp|default\.asp)?$ http://www.backprint.com/storefront.asp?PID=bp%13~Gu [R=301,NC,QSA]
    When I go to wideopenevents.org it takes me to backprint.com and not to the storefront. I'm pretty sure I know why there. Because it's looking for default.asp or storefront.asp. No asp on my website. I would imagine that it would ALWAYS be typed in wideopenevents.org with no filename or directory afterwards. And my sites are setup to look for index.php. So, I think I need to change (storefront\.asp|default\.asp) to (index\.php) assuming the \ before the . is escaping the period since a period turns out to be any non-whitespace character.

    Well, tried that and it didn't work...

    Second problem...

    When I go to wideopenevents.org/view_event.asp?pid=bp%13~Gu&eventid=112859 I get an error and the URL changes so I can't even seen what URL was actually attempted, even though I know what I copied and pasted.

    I guess some of this may be due to the DNS and forwarding changes possibly not being fully propagated?

    I'll play around with it a while and see what happens...
  20. #11
  21. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,131
    Rep Power
    4304
    Sorry. I don't have time to look at this today. I'll try to remember to take a look at it on Monday if you still need help then.

    In case you want to look at what exactly is being redirected to, the tool I used to look at the HTTP headers is a Firefox extension called Live HTTP Headers.
    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).
  22. #12
  23. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Location
    Glendale AZ
    Posts
    188
    Rep Power
    93
    So, theoretically, I should be able to (this is what I want to happen anyways) take:

    http://www.backprint.com/view_event.asp?pid=bp%13~Gu&eventid=112859

    and replace backprint.com with wideopenevents.org. When I do the first header is:

    http://www.wideopenevents.org/view_event.asp?pid=bp%13~Gu&eventid=112859

    that seems to be correct. But then I get the 301 moved permanently and it tells me this is the new address:

    Location: http://www.backprint.com/view_event.asp?PID=bp3~Gu&pid=bp%2513~Gu&eventid=112859

    Not only is the PID being duplicated but it's is changing from:

    bp%13~Gu to pid=bp%2513~Gu

    So I removed the from the PID to the end in the rewrite rule
    Code:
    RewriteRule ^\/?view_event.asp$ http://www.backprint.com/view_event.asp? [R=301,L,NC,QSA]
    and it got rid of the duplication but it's still changing bp%13~Gu to bp%2513~Gu.

    So I tackle the other option: wideopenevents.org > backprint.com/wideopenevents

    The first header is
    http://www.backprint.com/storefront.asp?PID=bp3~Gu (should be bp%13)

    So, just 'cause I have no idea what I'm doing I try to escape the % and the first header is still PID=bp3~Gu.

    I change the rule to
    Code:
    RewriteRule ^\/?(index\.php|storefront\.asp|default\.asp)?$ http://www.backprint.com/wideopenevents/ [R=301,NC,QSA]
    and get the same PID.

    I'll keep messing with it but I'm not holding my breath...
  24. #13
  25. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,131
    Rep Power
    4304
    Try this: (The "NE" flag tell the engine to not escape the "%" character.)

    RewriteEngine On

    RewriteCond %{HTTP_HOST} wideopenevents\.org$ [NC]
    RewriteRule ^\/?view_event.asp$ http://www.backprint.com/view_event.asp?PID=bp%13~Gu [R=301,L,NC,NE,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,QSA]
    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).
  26. #14
  27. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Location
    Glendale AZ
    Posts
    188
    Rep Power
    93
    Looking in Chrome the URL is:
    http://www.backprint.com/view_event.asp?pid=bp%13~Gu&eventid=112859
    In Firefox its:
    http://www.backprint.com/view_event.asp?pid=bp~Gu&eventid=112859 (even pasting it in here is adding the %13; I deleted it)

    That code is still duplicating the PID.

    When I get rid of from the PID and on I get the Ooops page. The URL ends .asp?& so it's trying to add the PID as another GET value on top of the one hard coded in the rewrite rule.

    Using
    Code:
    RewriteRule ^\/?view_event.asp$ http://www.backprint.com/view_event.asp [R=301,L,NC,NE,QSA]
    I got the event page working in Firefox. WILL NOT WORK in Chrome.

    Is this gonna need a separate line for each browser since they appear to be escaping things differently? I knew this would be a pain but this is kinda ridiculous they way the two browsers are behaving.
  28. #15
  29. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,131
    Rep Power
    4304
    Yeah, it's weird that Firefox doesn't show the "%13" in the address bar.

    Try this:
    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]
    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 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo