Mod Rewrite of Nichewatch

Discussion in 'Apache' started by Mong, Aug 18, 2006.

  1. #1
    Mong, Aug 18, 2006 IP
  2. Mong

    Mong ↓↘→ horsePower

    Messages:
    4,789
    Likes Received:
    734
    Best Answers:
    0
    Trophy Points:
    235
    #2
    Sorry! Title should be "URL Rewrite" no "Mod Rewrite". :cool:
     
    Mong, Aug 18, 2006 IP
  3. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #3
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^([^.]+)-([^.]+)\.html$ index.php?nicheword=$1+$2&cos=mos [L]
    RewriteRule ^([^.]+)\.html$ index.php?nicheword=$1&cos=mos [L]

    Yes, this is mod_rewrite!! :D
     
    Nintendo, Aug 18, 2006 IP
  4. Mong

    Mong ↓↘→ horsePower

    Messages:
    4,789
    Likes Received:
    734
    Best Answers:
    0
    Trophy Points:
    235
    #4
    Wow great :)
    Thank You Nintendo it works as i thought :)

    But now there is only one minor issue that is keywords search could be of any number of words like

    seo (1 word)
    ambatchdotcom seocontest (2 words)
    outdoor wood furnace (3 words)
    and it could be of 4,5..... and so on.

    Currently it works with 1 word and 2 words only it doesn't work with 2+ words.
     
    Mong, Aug 19, 2006 IP
  5. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #5
    RewriteRule ^([^.]+)\-([^.]+)\-([^.]+)\-([^.]+)\-([^.]+)\.html$ index.php?nicheword=$1+$2+$3+$4+$5&cos=mos [L]
    RewriteRule ^([^.]+)\-([^.]+)\-([^.]+)\-([^.]+)\.html$ index.php?nicheword=$1+$2+$3+$4&cos=mos [L]
    RewriteRule ^([^.]+)\-([^.]+)\-([^.]+)\.html$ index.php?nicheword=$1+$2+$3&cos=mos [L]
    RewriteRule ^([^.]+)\-([^.]+)\.html$ index.php?nicheword=$1+$2&cos=mos [L]
    RewriteRule ^([^.]+)\.html$ index.php?nicheword=$1&cos=mos [L]
     
    Nintendo, Aug 19, 2006 IP
    Mong likes this.
  6. Mong

    Mong ↓↘→ horsePower

    Messages:
    4,789
    Likes Received:
    734
    Best Answers:
    0
    Trophy Points:
    235
    #6
    haha :D
    Seeing it would solve 99% possible problem because only most foolish person would search keyword with 5+ words. :D

    But if there would be any then Errors would start and he would butt his head because it will run into loop where first 5 words would be considered 1 and last would be another 1 and rule of 2 would execute in case of 6 words searched.

    Sorry currently i am messing with english :D
     
    Mong, Aug 19, 2006 IP
  7. Mong

    Mong ↓↘→ horsePower

    Messages:
    4,789
    Likes Received:
    734
    Best Answers:
    0
    Trophy Points:
    235
    #7
    I have extended it to 9 :D
     
    Mong, Aug 19, 2006 IP
  8. Mong

    Mong ↓↘→ horsePower

    Messages:
    4,789
    Likes Received:
    734
    Best Answers:
    0
    Trophy Points:
    235
    #8
    btw Nintendo

    url rewrite is 301 redirection technically?
     
    Mong, Aug 24, 2006 IP
  9. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #9
    With mod-rewrite, you don't redirect to any URL, unlike the 301. Visitors will have no idea what the original URL is.

    It just makes fake URLs work.
     
    Nintendo, Aug 25, 2006 IP
  10. Mong

    Mong ↓↘→ horsePower

    Messages:
    4,789
    Likes Received:
    734
    Best Answers:
    0
    Trophy Points:
    235
    #10
    Then it wouldn't creae duplicate content issues with search engines ?
     
    Mong, Aug 25, 2006 IP
  11. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #11
    Depends on if you have any links to the original URLs.
     
    Nintendo, Aug 25, 2006 IP