Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 3 of 3

This is a discussion on what's the difference between these two htaccess lines? in the Shared & Semi-Dedicated forum
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)blah(-|.).*$ [OR] RewriteCond %{HTTP_REFERER} ^http://(www\.)?blah.*$ [OR] This part ?.*(-|.)blah(-|.).*$ vs ?blah.*$ Are they essentially the same? Or, should I have both in redirecting ...

  1. #1
    JPC Senior Member
    Join Date
    Mar 2005
    Posts
    64

    what's the difference between these two htaccess lines?

    RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)blah(-|.).*$ [OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?blah.*$ [OR]

    This part

    ?.*(-|.)blah(-|.).*$

    vs

    ?blah.*$

    Are they essentially the same? Or, should I have both in redirecting a specific referring url?
    Last edited by EliteRides; 10-12-2005 at 10:24 PM.

  2. #2
    Old Hillbilly Connie's Avatar
    Join Date
    Sep 2001
    Location
    Hills of Missouri
    Posts
    2,648
    There are several ways to do a redirect using mod_rewrite. This is what I use. the Options + is turned on by default on most servers but I use it just in case.


    This redirects domain.com to www.domain.com
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^domain\.com
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]

    If your doing an internal redirect then all you need is
    Redirect permanent /old-page.htm http://www.domain.com/new-page.htm

    Forum Moderators - Jag Staff

    Spam Whackers Blog - Dedicated to fighting Spam and providing General SEO Tips
    Organize your Kitchen or purchase Kitchen Accessories at Condells
    Ihelpyou Forum - Dedicated to "Best Practices" SEO

  3. #3
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)blah(-|.).*$ [OR]
    This one matches:
    * the http:// [^http://]
    * an optional www. [www\.)?]
    * any number of additional characters [.*]
    * a dash or any character [(-|.)] (though I suspect (-|\.) [dash or period] is intended
    * the literal string "blah" [blah]
    * the dash or char/dash or period thing again [(-|.)]
    * any additonal characters to the end of the line [.*$]

    RewriteCond %{HTTP_REFERER} ^http://(www\.)?blah.*$ [OR]
    This one is a little different. It matches:
    * the http:// [^http://]
    * an optional www. [www\.)?]
    * the literal string "blah" [blah]
    * any additonal characters to the end of the line [.*$]

    The difference is subtle, but important. The second would match things like blah.com, blahblah.com, blah-whatever.com (all with or without www on the beginning).

    The first would match yadda-blah-whatever.com, yadda.blah.whatever.com or (as writen) yaddablahwhatever.com.

    Essentially the first would catch anything with 'blah' somewhere in the URL whereas the second would only catch domain names that start with 'blah.'

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

Bookmarks

Posting Permissions

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