1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Mod Rewrite with variables from database.

Discussion in 'Apache' started by fatabbot, Jan 21, 2007.

  1. #1
    fatabbot, Jan 21, 2007 IP
  2. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #2
    How about this:

    http://www.site.com/image/45/something.html => imagepage.php?id=45
    http://www.site.com/image/46/something.html => imagepage.php?id=46
    http://www.site.com/image/46/another.html => imagepage.php?id=46

    ie, put your image-name in url, but ignore it on your RewriteRule.

    NOTE that I've used .html extension, this is because sometimes crawlers are trying to get partial URLs trying to detect duplicated urls. Example: for "http://www.site.com/image/46/" you should return a 404 page.

    Another better method could be requiring always a specific substring (like a fixed KEYWORD) just before the ".html" string. Exmaple:
    http://www.site.com/image/46/another-KEYWORD.html => imagepage.php?id=46
    http://www.site.com/image/46/another.html => 404 page

    TIP: Is better '-' than '_' in urls.
     
    ajsa52, Jan 22, 2007 IP
  3. fatabbot

    fatabbot Well-Known Member

    Messages:
    559
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    138
    #3
    I don't get it. How do I put the keyword in the url ?
     
    fatabbot, Jan 22, 2007 IP
  4. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #4
    On "something" and on "another" you can fill any phrase you like (extracted from your DB), because it's to be ignored by your RewriteRule.

    The second method, adding fixed keywords to the phrase used on 1st method (also ignored by your RewriteRule), is only to fight against crawlers with partial strings: on "KEYWORD" you need to put a FIXED PHRASE (related to your site) no extracted from DB.
    So the last part of your URL (after last '/') is formed with "a phrase extracted from DB" + "a fixed phrase" (to match your RewriteRule).
    Of course you can define several RewriteRule with different FIXED PHRASES.
     
    ajsa52, Jan 22, 2007 IP
    fatabbot likes this.
  5. fatabbot

    fatabbot Well-Known Member

    Messages:
    559
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    138
    #5
    If I put a keyword extracted from the DB there and it is ignored by the mod rewrite rules, will search engines ignore it too ? Because the only reason i want each page url to end with KEYWORD.html, is to be more search engine friendly.
     
    fatabbot, Jan 22, 2007 IP
  6. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #6
    That's why I recomment to adding a fixed phrase after DB phrase: to not be caught by search engines.
    I've sent you a PM with a working example on my site.
     
    ajsa52, Jan 22, 2007 IP
  7. fatabbot

    fatabbot Well-Known Member

    Messages:
    559
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    138
    #7
    Caught ? Does google penalize it ?
     
    fatabbot, Jan 22, 2007 IP
  8. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #8
    I guess no.
    Only if you use different URLS (ie different phrases to be ignored) to provide same content. That way you get penalized for duplicate content.
     
    ajsa52, Jan 22, 2007 IP