• [Mod] Search Engine Friendly URLs aka Short URLs 3 0 5 1
Currently:  

Author Topic: [Mod] Search Engine Friendly URLs aka Short URLs  (Read 726826 times)

0 Members and 2 Guests are viewing this topic.

drhtm

  • Guest
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #75 on: June 10, 2005, 05:01:25 AM »
If I create this in my htaccess

RewriteRule ^profile([0-9]+)\.htm$ member.php?action=showprofile&user_id=$1&%{QUERY_STRING}

how can i manipulate my sessions.php so my entire site will recognize this and change it accordingly, as it was initially done by V@no with the categories, details, etc.

Also, I have the wonderful mod called Private Messaging (newest version) and would like to set the htacesss/sessions.php accordingly too.  any ideas?

Offline kief24

  • Sr. Member
  • ****
  • Posts: 267
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #76 on: July 14, 2005, 12:50:59 PM »
Hello,

The search engine friendly URL works fine on my site.

If i look how Google works, i see that if you type a search term, like "coloring", the first sites given by google are very often the ones that have the word "coloring" in the title of the page, and in the url.
Concerning the title, i installed a mod from 4images that gives the desired title with the word "coloring" on every page.
But for the url : they are short now, but there i am missing the word "coloring".
"Coloring" is the main keyword for my site, most visitors coming from search engines searched using that word ( along with other words ).

So my question is:

Should there be a way to "insert" the major keyword in the url ?


Maybe an adjustment in the rewrite mod ?

I think this would give a positive effect on the ranking in search engines.

Thx

Offline Vincent

  • 4images Moderator
  • Addicted member
  • *****
  • Posts: 1.195
    • View Profile
    • www.foto-kocher.com
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #77 on: July 14, 2005, 01:10:06 PM »
.htaccess  is not working with windows-Server - is this information correct?!
if it is correct how could i do something like this Mod?

sincerly
vincent
Beati pauperi spiritus

4images 1.7 // My Installed Mods


Offline kindian

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #78 on: July 14, 2005, 08:29:50 PM »
everything is working with me the only problem is that i've also added the User Private's link.
With this mod I had to edit my root .htaccess i've added:

<files *>
Options MultiViews
</files>

So when I try to put this mod in the file, either one mod works and the other fails or vice-versa.
i've tryed to add your piece of code in the beggining, end, middle and no success.

can someone help me?

Offline kief24

  • Sr. Member
  • ****
  • Posts: 267
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #79 on: July 14, 2005, 10:08:02 PM »
this was my question :

Hello,

The search engine friendly URL works fine on my site.

If i look how Google works, i see that if you type a search term, like "coloring", the first sites given by google are very often the ones that have the word "coloring" in the title of the page, and in the url.
Concerning the title, i installed a mod from 4images that gives the desired title with the word "coloring" on every page.
But for the url : they are short now, but there i am missing the word "coloring".
"Coloring" is the main keyword for my site, most visitors coming from search engines searched using that word ( along with other words ).

So my question is:

Should there be a way to "insert" the major keyword in the url ?

So :
http://www.edupics.com/cat167.htm
would become
http://www.edupics.com/coloring/cat167.htm

or
http://www.edupics.com/img1104.htm
would become
http://www.edupics.com/coloring/img1104.htm

Maybe an adjustment in the rewrite mod ?

I think this would give a positive effect on the ranking in search engines.

Thx

i found the solution myself.

on my dutch site, "kleurplaten" is the major keyword.
so i have all the words "cat" in the url being replaced by "kleurplaten"

so the adress
http://www.schoolplaten.com/cat179.htm
becomes
http://www.schoolplaten.com/kleurplaten179.htm
The keyword is now in the url.

how i did it :

i changed .htaccess

this
Code: [Select]
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
RewriteRule ^cat([0-9]+)\.([0-9]+)\.htm$ categories.php?cat_id=$1&page=$2&%{QUERY_STRING}
RewriteRule ^cat([0-9]+)\.htm$ categories.php?cat_id=$1&%{QUERY_STRING}

into this
Code: [Select]
RewriteRule ^kleurplaten\.htm$ categories.php?%{QUERY_STRING}
RewriteRule ^kleurplaten([0-9]+)\.([0-9]+)\.htm$ categories.php?cat_id=$1&page=$2&%{QUERY_STRING}
RewriteRule ^kleurplaten([0-9]+)\.htm$ categories.php?cat_id=$1&%{QUERY_STRING}


and i changed sessions.php

this
Code: [Select]
elseif (strstr($url, 'categories.php')) {
        if (strstr($url, 'cat_id=') && strstr($url, 'page=')) {
          preg_match('#cat_id=([0-9]+)&?#', $url, $matches1);
          preg_match('#page=([0-9]+)&?#', $url, $matches2);
          if (isset($matches1[1]) && isset($matches2[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('categories.php', 'cat'.$matches1[1].'.'.$matches2[1].'.htm', $url);
            $query = str_replace('cat_id='.$matches1[1].'&', '', $query);
            $query = str_replace('&cat_id='.$matches1[1], '', $query);
            $query = str_replace('cat_id='.$matches1[1], '', $query);
            $query = str_replace('page='.$matches2[1].'&', '', $query);
            $query = str_replace('&page='.$matches2[1], '', $query);
            $query = str_replace('page='.$matches2[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        elseif (strstr($url, 'cat_id=')) {
          preg_match('#cat_id=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('categories.php', 'cat'.$matches[1].'.htm', $url);
            $query = str_replace('cat_id='.$matches[1].'&', '', $query);
            $query = str_replace('&cat_id='.$matches[1], '', $query);
            $query = str_replace('cat_id='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('categories.php', 'cat.htm', $url);
        }
      }


into this :

Code: [Select]
elseif (strstr($url, 'categories.php')) {
        if (strstr($url, 'cat_id=') && strstr($url, 'page=')) {
          preg_match('#cat_id=([0-9]+)&?#', $url, $matches1);
          preg_match('#page=([0-9]+)&?#', $url, $matches2);
          if (isset($matches1[1]) && isset($matches2[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('categories.php', 'kleurplaten'.$matches1[1].'.'.$matches2[1].'.htm', $url);
            $query = str_replace('cat_id='.$matches1[1].'&', '', $query);
            $query = str_replace('&cat_id='.$matches1[1], '', $query);
            $query = str_replace('cat_id='.$matches1[1], '', $query);
            $query = str_replace('page='.$matches2[1].'&', '', $query);
            $query = str_replace('&page='.$matches2[1], '', $query);
            $query = str_replace('page='.$matches2[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        elseif (strstr($url, 'cat_id=')) {
          preg_match('#cat_id=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('categories.php', 'kleurplaten'.$matches[1].'.htm', $url);
            $query = str_replace('cat_id='.$matches[1].'&', '', $query);
            $query = str_replace('&cat_id='.$matches[1], '', $query);
            $query = str_replace('cat_id='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('categories.php', 'kleurplaten.htm', $url);
        }
      }

so basicly i just replaced "cat" by "kleurplaten" in these places.


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #80 on: July 15, 2005, 12:10:11 AM »
everything is working with me the only problem is that i've also added the User Private's link.
what exactly Multiviews has to do with "Private link" ?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline bibabobu

  • Sr. Member
  • ****
  • Posts: 311
  • Technische und künstlerische Gravuren
    • View Profile
    • Technische und künstlerische Gravuren für die gesamte Metall-, Kunststoff- und Papierindustrie
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #81 on: July 15, 2005, 01:31:50 AM »
Sorry i have some general questions :?:

1. Where could i find the .htaccess file? i can't find it in the root directory? Is it like a hiden file or something like that?
2. Does it work with windows apache server?
3. How could i make changings in that file? Do i need some special applications?

Thanks for answering.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #82 on: July 15, 2005, 03:04:56 AM »
1) on some server it is hidden. also it might not exist.
2) yes
3) notepad ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline marod0er

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #83 on: July 16, 2005, 03:09:52 PM »
I want to use Rewrite on the upload feature as well.

Therefor I have entered this into .htaccess:

Quote
RewriteRule ^catupload([0-9]+)\.html$ member.php?action=uploadform&cat_id=$1&%{QUERY_STRING}

But it doesn't work. Why not?

Thanks
Greetz: Lasse

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #84 on: July 16, 2005, 06:49:26 PM »
how many times I must repeat this question:

it doesnt work HOW?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline marod0er

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #85 on: July 16, 2005, 10:28:08 PM »
Does it matter "how" it doesn't work?

It just shows the main page.
Greetz: Lasse

Offline marod0er

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #86 on: July 16, 2005, 11:45:04 PM »
I took the example of one of the previous posters, whom wanted to rewrite the profile of his users to static links.
Then, I just tried to make it fit the upload section of the member.php file.

Note: I havn't changed anything in sessions.php

Anyway, I would think that I would be redirected to the upload page by entering the following URL:
www.mysite.com/catupload1.html - but it doesn't. INstead, it just shows the frontpage

Any idea how to fix this?
Greetz: Lasse

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #87 on: July 17, 2005, 12:36:52 AM »
Anyway, I would think that I would be redirected to the upload page by entering the following URL:
www.mysite.com/catupload1.html - but it doesn't. INstead, it just shows the frontpage
very well. would u show the line(s) you've added into .htaccess? actualy the whole .htaccess would be better ;) (pm me if u dont want to show it in public)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline marod0er

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #88 on: July 17, 2005, 12:40:59 AM »
Sure, I can show it here, np:

Code: [Select]
# Begin search engine friendly links code
RewriteEngine On
#RewriteBase /
RewriteRule ^lightbox\.html$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.html$ lightbox.php?page=$1&%{QUERY_STRING}

RewriteRule ^search\.html$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.html$ search.php?page=$1&%{QUERY_STRING}

RewriteRule ^cat\.html$ categories.php?%{QUERY_STRING}
RewriteRule ^cat([0-9]+)\.([0-9]+)\.html$ categories.php?cat_id=$1&page=$2&%{QUERY_STRING}
RewriteRule ^cat([0-9]+)\.html$ categories.php?cat_id=$1&%{QUERY_STRING}

RewriteRule ^pic([0-9]+)\.html$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^pic([0-9]+)\.([a-zA-Z0-9]+)\.html$ details.php?image_id=$1&mode=$2&%{QUERY_STRING}

RewriteRule ^postcard([a-zA-Z0-9]+)\.html$ postcards.php?postcard_id=$1&%{QUERY_STRING}
RewriteRule ^postcard\.img([0-9]+)\.html$ postcards.php?image_id=$1&%{QUERY_STRING}

RewriteRule ^catupload([0-9]+)\.html$ member.php?action=uploadform&cat_id=$1&%{QUERY_STRING}

# End search engine friendly links code

Actually, that's it.  8)
Greetz: Lasse

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #89 on: July 17, 2005, 01:02:44 AM »
I see no problem with the code and it worked on my site (tested it).
can u show a link to your site?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)