Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

TechTip: Be a Web Wiz

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TechTip: Be a Web Wiz

    ** This thread discusses the article: TechTip: Be a Web Wiz **
    ** This thread discusses the Content article: TechTip: Be a Web Wiz **
    0

  • #2
    TechTip: Be a Web Wiz

    ** This thread discusses the article: TechTip: Be a Web Wiz **
    The author welcomes readers' comments and questions about URL Rewriting. What parts of the article were helpful? Confusing? Where could URL Rewriting help you? Thanks, Alan Seiden

    Comment


    • #3
      TechTip: Be a Web Wiz

      ** This thread discusses the article: TechTip: Be a Web Wiz **
      Thanks for the great information. This is close to what I've been looking for. One thing I'm still having a hard time with is protecting only certain parts of my web site. I wish to protect certain folders (i.e. www.domain.com/admin, www.domain.com/cart, etc..). The article presented showed how to do that, but when I select to go back to the homepage, www.domain.com, the URL stays in https. I've tried to have a rewrite rule that covers everything else but the particular folders I'm protecting, but then I receive error messages in my browser. Any ideas are greatly appreciated. Matt
      Code

      Comment


      • #4
        TechTip: Be a Web Wiz

        ** This thread discusses the article: TechTip: Be a Web Wiz **
        Matt, You are on the right track. Your RewriteCond directive will only act on requests where the port is NOT 443, i.e., not SSL. You did this to redirect non-SSL requests to SSL. For this reason, it's the wrong place to put the second RewriteRule directive (that you're using to redirect from port 443 to port 80, HTTP). You want that directive to run when the port IS already 443. One solution is to add a second RewriteCond block that checks for requests from port 443. I've pasted some code in for you to look at. Although I haven't tested it, it should give you the idea. Let us know if this works for you. Good luck, Alan
        Code

        Comment


        • #5
          TechTip: Be a Web Wiz

          ** This thread discusses the article: TechTip: Be a Web Wiz **
          Here's one of my favorite uses of mod_rewrite. A lot of people were linking directly to images on my web site. This is a problem since such linking obscures the photos true source, as well as causing additional load on my monthly bandwidth allowance. See the code sample below. What does this do? First, if there is no HTTP_REFERER, it simply accepts the request as is. Second, if the referrer is a page on my site, again, the request is accepted. Otherwise, if the request is to a jpeg or gif file in directory photos or thumbs, the request is converted to a silly small gif image which is very clearly not what the image thief wants. Some image thieves notice what has happened, but interestingly, many seem oblivious. I recommend using an image that may well provide some embarassment to the thief. Note that this won't stop someone from stealing the image and hosting it on another server. Nothing can effectively stop that. But it will mean that you don't suffer any additional bandwidth costs. Cheers! Hans
          Code

          Comment


          • #6
            TechTip: Be a Web Wiz

            ** This thread discusses the article: TechTip: Be a Web Wiz **
            Hans, thanks for the technique. As you showed, Apache can respond to the same URL request in different ways according to context. URL Rewriting can test numerous variables, including the referrer (as you did), the user agent (browser), and time of day. Best regards, Alan Seiden

            Comment

            Working...
            X