• 06-10-2010, 13:59:25
    #1
    Üyeliği durduruldu
    Arkadaşlar elimde bir DLE eklentisi var.Gelen google aramalarını ve site içi aramaları kaydedip yeni sayfa oluşturarak "search term spam" gibi birşey yapıyor.Ama sorun şu ki Rewritesi çok kötü.Boşlukları + olarak çeviriyor,Sayfaların başına /search/ ekliyor.

    /search/ ı değiştirebiliyorum htaccesstan ama oraya nasıl rastgele bir harf koyacağımı ya da + ları - olarak yapacağımı beceremedim.

    Anlayan arkadaşlar bir yardımcı olursa çok sevinirim.

    Örnek url ler
    http://1stwarez.com/search/Lynda.com-+Photoshop.html
    http://1stwarez.com/search/skinning+a+low+res.html
    http://1stwarez.com/search/kelby.html
    http://1stwarez.com/search/photoshop+cs6.html
    Htaccess

    DirectoryIndex index.php
    
    RewriteEngine On
    
    # Redirects
    RewriteRule ^page/(.*)$ index.php?cstart=$1 [L]
    
    # Post
    RewriteRule ^search/(.*).html?$ /index.php?do=searchcloud&subaction=search&story=$1&x=$4&y=$5 [L] 
    RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/page,([0-9]+),([0-9]+),(.*).html(/?)+$ index.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&cstart=$5&news_name=$6 [L]
    RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/page,([0-9]+),(.*).html(/?)+$ index.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&news_name=$5 [L]
    RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/print:page,([0-9]+),(.*).html(/?)+$ engine/print.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&news_name=$5 [L]
    RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*).html(/?)+$ index.php?subaction=showfull&year=$1&month=$2&day=$3&news_name=$4 [L]
    
    RewriteRule ^([^.]+)/page,([0-9]+),([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$4&news_page=$2&cstart=$3 [L]
    RewriteRule ^([^.]+)/page,([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$3&news_page=$2 [L]
    RewriteRule ^([^.]+)/print:page,([0-9]+),([0-9]+)-(.*).html(/?)+$ engine/print.php?news_page=$2&newsid=$3 [L]
    RewriteRule ^([^.]+)/([0-9]+)-(.*).html(/?)+$ index.php?newsid=$2 [L]
    
    RewriteRule ^page,([0-9]+),([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$3&news_page=$1&cstart=$2 [L]
    RewriteRule ^page,([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$2&news_page=$1 [L]
    RewriteRule ^print:page,([0-9]+),([0-9]+)-(.*).html(/?)+$ engine/print.php?news_page=$1&newsid=$2 [L]
    RewriteRule ^([0-9]+)-(.*).html(/?)+$ index.php?newsid=$1 [L]
    
    # For day
    RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})(/?)+$ index.php?year=$1&month=$2&day=$3 [L]
    RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/page/([0-9]+)(/?)+$ index.php?year=$1&month=$2&day=$3&cstart=$4 [L]
    # For all months
    RewriteRule ^([0-9]{4})/([0-9]{2})(/?)+$ index.php?year=$1&month=$2 [L]
    RewriteRule ^([0-9]{4})/([0-9]{2})/page/([0-9]+)(/?)+$ index.php?year=$1&month=$2&cstart=$3 [L]
    # Output for the entire year
    RewriteRule ^([0-9]{4})(/?)+$ index.php?year=$1 [L]
    RewriteRule ^([0-9]{4})/page/([0-9]+)(/?)+$ index.php?year=$1&cstart=$2 [L]
    # Output for tags
    RewriteRule ^tags/([^/]*)(/?)+$ index.php?do=tags&tag=$1 [L]
    RewriteRule ^tags/([^/]*)/page/([0-9]+)(/?)+$ index.php?do=tags&tag=$1&cstart=$2 [L]
    # Output for users
    RewriteRule ^user/([^/]*)/rss.xml$ engine/rss.php?subaction=allnews&user=$1 [L]
    RewriteRule ^user/([^/]*)(/?)+$ index.php?subaction=userinfo&user=$1 [L]
    RewriteRule ^user/([^/]*)/page/([0-9]+)(/?)+$ index.php?subaction=userinfo&user=$1&cstart=$2 [L]
    RewriteRule ^user/([^/]*)/news(/?)+$ index.php?subaction=allnews&user=$1 [L]
    RewriteRule ^user/([^/]*)/news/page/([0-9]+)(/?)+$ index.php?subaction=allnews&user=$1&cstart=$2 [L]
    RewriteRule ^user/([^/]*)/news/rss.xml(/?)+$ engine/rss.php?subaction=allnews&user=$1 [L]
    # Output for last news
    RewriteRule ^lastnews/(/?)+$ index.php?do=lastnews [L]
    RewriteRule ^lastnews/page/([0-9]+)(/?)+$ index.php?do=lastnews&cstart=$1 [L]
    # Output for catalog
    RewriteRule ^catalog/([^/]*)/rss.xml$ engine/rss.php?catalog=$1 [L]
    RewriteRule ^catalog/([^/]*)(/?)+$ index.php?catalog=$1 [L]
    RewriteRule ^catalog/([^/]*)/page/([0-9]+)(/?)+$ index.php?catalog=$1&cstart=$2 [L]
    # Output for new posts
    RewriteRule ^newposts(/?)+$ index.php?subaction=newposts [L]
    RewriteRule ^newposts/page/([0-9]+)(/?)+$ index.php?subaction=newposts&cstart=$1 [L]
    # Static page
    RewriteRule ^static/(.*).html(/?)+$ index.php?do=static&page=$1 [L]
    # Output for favorites news
    RewriteRule ^favorites(/?)+$ index.php?do=favorites [L]
    RewriteRule ^favorites/page/([0-9]+)(/?)+$ index.php?do=favorites&cstart=$1 [L]
    
    RewriteRule ^rules.html$ index.php?do=rules [L]
    RewriteRule ^statistics.html$ index.php?do=stats [L]
    RewriteRule ^addnews.html$ index.php?do=addnews [L]
    RewriteRule ^rss.xml$ engine/rss.php [L]
    RewriteRule ^sitemap.xml$ uploads/sitemap.xml [L]
    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^.]+)/page/([0-9]+)(/?)+$ index.php?do=cat&category=$1&cstart=$2 [L]
    RewriteRule ^([^.]+)/?$ index.php?do=cat&category=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^.]+)/rss.xml$ engine/rss.php?do=cat&category=$1 [L]
    RewriteRule ^page,([0-9]+),([^/]+).html$ index.php?do=static&page=$2&news_page=$1 [L]
    RewriteRule ^print:([^/]+).html$ engine/print.php?do=static&page=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/]+).html$ index.php?do=static&page=$1 [L]

    Koyuyla yazılmış olan Gelen aramaları "Rewrite" yapıp SEO uyumlu hale getirmekte.Diğerleriyle bağlantılı olabilir diye hepsini veriyorum.

    Bu konuyu açarken str_replace(' ', '+', $row['tag']) .
    str_replace(' ', '-', $row['tag']) . ile değiştirirken re-write sorununu çözdüm.

    Edit. Değiştirdim ama genede + olarak değiştiriyor karakterleri.Sorunu ne anlamadım.

    Searchcloud.php'de
    <?php
    
    require_once ROOT_DIR.'/engine/modules/connect.php';
    
    $query = "SELECT tag FROM dle_search ORDER BY id DESC limit 0, 30";
    $result = mysql_query($query);
    while($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
    echo "<a href='/search/" . str_replace(' ', '-', $row['tag']) . ".html'>{$row['tag']}</a> | ";
    }
    ?>
    /search/ bölümüne ve htaccess'a Rastgele karakter verirsek olucak sanırım.Ama Mysql den rastgele çektiğimiz karakter htaccesste olur mu acaba.?
  • 06-10-2010, 21:31:44
    #2
    Üyeliği durduruldu
    Konu güncel.
  • 07-10-2010, 17:02:24
    #3
    Üyeliği durduruldu
    güncel.