4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Chris on March 14, 2005, 04:17:30 PM

Title: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Chris on March 14, 2005, 04:17:30 PM
Quote
There is some speculation as to whether or not a search engine will crawl pages that have a URL with a query string:
Code: [Select]
categories.php?cat_id=12&page=2The webmaster documentation for some search engines suggests their crawlers will not crawl pages with these types of URLs as they may represent and INFINITE URL space. Frankly, Google has ALWAYS crawled all of my web pages with these URLs with no problems. My opinion is that it is the session id in a query string that may influence the crawler.

The following was recovered from search engine cache and restored by me. I did not write this mod

This mod will convert your 4images URLs into shorter URLs and remove the query string. This mod requires an Apache compatible web server.

Step 1
Open /includes/sessions.php
Find:
Code: [Select]
function url($url, $amp = "&") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];

if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}

if (!empty($l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}

$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
}
Replace with:
Code: [Select]
/* ORIGINAL CODE
function url($url, $amp = "&") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];

if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}

if (!empty($l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}

$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
}
*/
function url($url, $amp = "&") {
global $l, $user_info;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
$url = str_replace('&', '&', $url);
if (!defined('IN_CP')) {
if (strstr($url, 'index.php')) {
$url = str_replace('index.php', './', $url);
}
elseif (strstr($url, 'search.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('search.php', 'search.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('search.php', 'search.htm', $url);
}
}
elseif (strstr($url, 'lightbox.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('lightbox.php', 'lightbox.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('lightbox.php', 'lightbox.htm', $url);
}
}
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);
}
}
elseif (strstr($url, 'details.php?image_id=')) {
if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', 'img'.$matches1[1].'.'.$matches2[1].'.htm', $url);
$query = str_replace('image_id='.$matches1[1].'&', '', $query);
$query = str_replace('&image_id='.$matches1[1], '', $query);
$query = str_replace('image_id='.$matches1[1], '', $query);
$query = str_replace('mode='.$matches2[1].'&', '', $query);
$query = str_replace('&mode='.$matches2[1], '', $query);
$query = str_replace('mode='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', 'img'.$matches[1].'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
elseif (strstr($url, 'postcards.php?image_id=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
if ($this->mode == "get" && strstr($url, $this->session_id)) {
$url .= strpos($url, '?') !== false ? '&' : '?';
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= strpos($url, '?') ? '&' : '?';
$url .= "l=".$l;
}
$url = str_replace('&', $amp, $url);
$url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
return $url;
}

Step 2
Create a new file named .htaccess (note the leading period that starts the file name) or edit your existing .htaccess file in the root level of your 4images installation. Place the following lines inside that file:
Code: [Select]
# Begin search engine friendly links code
RewriteEngine On
#RewriteBase /
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}

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

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}

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

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

# End search engine friendly links code

If for some reason it doesnt work for u, make sure that mod_rewrite is installed on your server and that the vdomain/dir of yours has permissions to use it (contact your hoster if u are not sure).
If it still doesnt work, try to uncomment:
Code: [Select]
#RewriteBase /
and replace / with the path to 4image root dir in your address bar.
(for example if your gallery address is: www.example.com/pix/
then u should add:
Code: [Select]
RewriteBase /pix/
Revision History:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Spadver on March 14, 2005, 08:12:05 PM
Thank you!

But is it all?

As far as I remember, there must be some additional code in 4images.

May be for getting
Quote
QUERY_STRING
?

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Chris on March 14, 2005, 08:35:19 PM
That's it.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on March 15, 2005, 05:43:26 PM
No, there's more.

I remember changing something sessions.php
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Chris on March 15, 2005, 06:37:59 PM
Yeah, I came across it while digging through search engine cached pages.  I've updated the original post
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: G4 on March 15, 2005, 09:14:50 PM
a situpid question :?

i made all the changes, but how can i see that it is working?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on March 16, 2005, 12:27:42 AM
a situpid question :?

i made all the changes, but how can i see that it is working?
just visit your site and see what kind of URLs it shows
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on March 16, 2005, 08:07:23 PM
Thanks for making the change chris, appreciate it... This is for version 1.7.1 right?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: redhead_tn on March 16, 2005, 09:41:19 PM
worked "right out the box" ... thanks

using with 4images 1.7
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on March 16, 2005, 11:38:03 PM
This is for version 1.7.1 right?
originaly it was made before v1.7.1 even planned to be released ;)
but it should work with v1.7.1 as well.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: G4 on March 16, 2005, 11:55:15 PM
if the links look like this
http://www.website.com/galerie/details.php?image_id=48&sessionid=0e5c89cf1ac5434bb45223b0e62dc28c
it doesnt work

and if ithey look like this
http://www.website.com/details.php?image_id=8
it works.

is this right?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on March 16, 2005, 11:59:56 PM
if the links look like this
http://www.website.com/galerie/details.php?image_id=48&sessionid=0e5c89cf1ac5434bb45223b0e62dc28c
it doesnt work

and if ithey look like this
http://www.website.com/details.php?image_id=8
it works.

is this right?

Not quite. Those 2 URLs you have there are the same. The one on top just has a sessionid.

It should look like this:

http://www.website.com/img8.htm (assuming you havn't made any changes to your .htaccess file)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: abdoh2010 on March 21, 2005, 08:45:07 PM
could you pleass update it to 1.7.1 ?

it's dont work with it
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: abdoh2010 on March 21, 2005, 09:02:18 PM
i fix it

it only need '}' at the end of the code
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on March 24, 2005, 06:31:22 PM
Can anyone make it, so it's able to convert those "template" pages to html files as well?

I mean:

Let's say you have this MOD running perfectly, but you also has extra pages that's not originally "in the software" like, if you have a page named "Privacy Policy" or whatever, you can get 4images to make a page, that runs on the index.php. It will look something like this: http://www.site.com/index.php?template=privacy

Now, what I want, is to get it to look like: http://www.site.com/privacy.html

Is this possible? I bet it is... Vano, a little help? ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on March 24, 2005, 11:43:55 PM
its very easy ;)
here is a specific for privacy.html:
Code: [Select]
RewriteRule ^privacy\.html$ index.php?template=privacy&%{QUERY_STRING}and here is "general" that would translate every .html file into index.php?template=<name>
add it at the very end of .htaccess:
Code: [Select]
RewriteRule ^([a-zA-Z0-9_-]+)\.html$ index.php?template=$1&%{QUERY_STRING}so it should "translate" blah.html into index.php?template=blah
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on March 25, 2005, 01:27:21 PM
I should've seen that one coming :)

anyway, thanks - i'll try it out when I get around to it.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: G4 on March 25, 2005, 03:07:03 PM
does mod rewrite change the files on the server?
or are the *.htm files only temporary created? im afraid of destroying my files with this mod
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on March 26, 2005, 04:05:34 AM
mod rewrite does not change the files, all it does it make the server handle the requests differently.
I can not say for sure what would happend if u have index.html file and with mod rewrite it would "translate" index.html into index.php
I havent test it myself yet ;)

P.S. its a good question though.

[edit] checked and mod_rewrite overule the existing files...meaing index.html file can not be accessed if mod_rewrite "translate" index.html into index.php
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: seksihatun on March 29, 2005, 07:32:59 PM
Hi
is it true for second page
RewriteRule ^hatunlar([0-9]+)\.([0-9]+)\.htm$ categories.php?cat_id=$1&page=$2&%{QUERY_STRING}
because when i put like this i am getting error like

http://www.website.com/.htmhtm=31?page=2

what is problem???
my session.php is

     if (isset($matches1[1]) && isset($matches2[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('categories.php', 'hatunlar'.$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', 'hatunlar'.$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', 'hatunlar.htm', $url);
        }
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on March 29, 2005, 07:38:53 PM
Hi
is it true for second page
RewriteRule ^hatunlar([0-9]+)\.([0-9]+)\.htm$ categories.php?cat_id=$1&page=$2&%{QUERY_STRING}
because when i put like this i am getting error like

http://www.website.com/.htmhtm=31?page=2
the question is: did it work BEFORE u changed the original code of this "mod"? (I'm talking about the code posted on first page)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: seksihatun on March 29, 2005, 07:49:13 PM
no i changed to original code posted first page in this subject.it did not work..

still they like
http://www.website.com/.htmhtm=379?page=2

but there is no problem first page of category
http://www.website..com/cat379.htm
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: tikle on March 30, 2005, 03:40:25 AM
Forbidden
You don't have permission to access / on this server.

Apache/1.3.33 Server at www... Port 80

 :(

 :?:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on March 30, 2005, 04:02:11 AM
Forbidden
You don't have permission to access / on this server.

Apache/1.3.33 Server at www.fotomir.de Port 80

 :(

 :?:
too bad
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: nX on March 30, 2005, 03:27:35 PM
Thanks for this great mod.
It`s working smoothly.

Now the time of waiting-for-the-google-bot hat startet again  :mrgreen:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Legendary on March 30, 2005, 05:31:43 PM
It is possible to change cat#.htm and img#.htm to their name instead?

Example:  if the name for "cat1.htm" is say Family Pictures, is there a way to change it to FamilyPictures.htm?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on March 30, 2005, 07:31:47 PM
It is possible to change cat#.htm and img#.htm to their name instead?

Example: if the name for "cat1.htm" is say Family Pictures, is there a way to change it to FamilyPictures.htm?
no, its not. As I tryed explained several times before the hack, 4images is based on IDs (category id, image id, user id, etc) and names could be the same for each item, there for if it happend that u have two category with the same name, which category would u show?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: tikle on March 30, 2005, 10:03:32 PM
Forbidden
You don't have permission to access / on this server.

Apache/1.3.33 Server at www.fotomir.de Port 80

 :(

 :?:
too bad

what can i doo?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on March 30, 2005, 10:16:14 PM
what can i doo?
u could start by explaining what is the problem and how/when it accures.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Vincent on April 03, 2005, 09:25:44 PM
i got a error
homepage not available!
why this happen?

sincerly
vincent
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 03, 2005, 09:30:42 PM
According to phpinfo from your page, your server is running IIS webserver which does not support .htaccess files, therefore this mod will not work for u.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on April 03, 2005, 09:42:39 PM
I have the MOD working fine, but it still uses session id in the url.

EX:
I have an URL like this:
www.site.com/img1.htm?sessionid=3234235345345345345

How do I force 4images NOT to use session id's? I want to remove it, because search engines can't spider a site using session id.

Thanks.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 03, 2005, 10:04:39 PM
How do I force 4images NOT to use session id's? I want to remove it, because search engines can't spider a site using session id.
4images is based on sessions, removing them might break 4images. also, most of modern search engines spiders dont care about sessionid, they ignoring them, so, u dont have to worry about it.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Vincent on April 03, 2005, 10:05:30 PM
V@no
it seems you konw everithing!
thanks for the info

vincent
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on April 03, 2005, 10:09:35 PM
Well, not exactly. Google has problems working around it.

The thing I don't understand, is I've never had this problem before. Why does it suddenly generate sessionid's on internal html links? Havn't experienced that before...

But nevermind messing something up, how do I remove those session id's?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on April 04, 2005, 05:42:27 PM
I'd appreciate a solution to this...

Thanks!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on April 05, 2005, 03:47:03 PM
Apparently it automatically adds the session id to every dynamic URL I have on my page.

Like, for instance:
I have a link script, which looks something like this: partners.php?type=out&id=2

4images automatically adds partners.php?type=out&id=2&sessionid=234825374165374blablablabla

This is bad. Can anyone pleeeeease help??

Thanks a lot!
Lasse
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: omid4u on April 08, 2005, 11:15:58 AM
I like change my URL similar to v@no gallery
www.example.com/xx  and xx= image id.
Please help me to understand this
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: wildnis on April 12, 2005, 01:13:43 AM
Hi Chris,

I have a problem with the rewrite. If we use our search we get results ok, but when I click on a search pictures I get like:


http://www.hickerphoto.com/pictures_4396.search.html

How can I get rid of the .search.
the right output should be:

http://www.hickerphoto.com/pictures_4396.html

Can you help me there?? I get penalized by google for duplicated content - makes sense, they are both the same pictures

appreciate your help
thanks
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 12, 2005, 01:40:03 AM
replace:
Code: [Select]
            $url   = str_replace('details.php', 'img'.$matches1[1].'.'.$matches2[1].'.htm', $url);with:
Code: [Select]
            $url   = str_replace('details.php', 'img'.$matches1[1].(($matches2[1] != "search") ? '.'.$matches2[1] : "").'.htm', $url);but I must warn u, u will loose feature that displays previous/next image from the search result in the image details page.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: wildnis on April 12, 2005, 01:43:52 AM
where??
in the search.php or htaccess

thanks again
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 12, 2005, 01:47:47 AM
ah, c'mon! think! ;)
open the first page and search for the line I mentioned...

*cough* sessions.php *cough*
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 12, 2005, 01:50:06 AM
or another alternative replace in search.php:
Code: [Select]
    show_image($image_row, "search");with:
Code: [Select]
    show_image($image_row);(I think this is better ;))
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: wildnis on April 12, 2005, 02:01:25 AM
Hi,
I used your tip with the search.php

it works!

thank you so much

you are gold!!!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: ascanio on April 18, 2005, 06:45:40 AM
Hi every one I'm trying to install this MOD But i'm having some problems

Code: [Select]
Not Found
The requested URL /home/ascanio/public_html/details.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.33 Server at 69.56.196.226 Port 80

I have read all the post but i'm not very familiar with the .htaccess can anybody help me?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 18, 2005, 06:57:56 AM
try to play with RewriteBase setting (read the original post)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: daniel_74 on April 20, 2005, 10:45:00 PM
Hallo V@no,

on this thread you say, session Id removing will destroy 4images, and on thsi thread you say it works:
http://www.4homepages.de/forum/index.php?topic=6951.msg30709#msg30709

Whats right now? Can I remove session IDs and make short URLs ?

Best regards,
Daniel
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 21, 2005, 12:23:53 AM
these are two different session ids we were talking about. The one from the topic u showed is what PHP automaticaly add to every link on the page and the session id that 4images adds is something that 4images required to work properly.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: daniel_74 on April 21, 2005, 02:15:28 AM
Thanks,

so there is no possibility to get rid of the session ids of 4images? will google index the pages anyway ? Any experiences about that ?

Regards,
Daniel
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 21, 2005, 02:20:11 AM
no, yes and yes (for all three your questions ;))
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: daniel_74 on April 21, 2005, 02:39:56 AM
when navifating through your site, Ive seen that you have even cooler URLs...

instead of
http://gallery.vano.org/en/11991.htm
you have
http://gallery.vano.org/en/11991

How is this done?
Also the language URL is done in cool style ...
Will the mod do that also like in your site?

Regards, and thanks.
Daniel
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 21, 2005, 03:00:34 AM
sorry, that method would require alot more changes in many .php files and require very complex .htaccess
but u could try remove .htm from sessions.php and adjust .htaccess
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: daniel_74 on April 21, 2005, 08:39:46 PM
Hello again,

could you tell me please how I can have:

http.//www.nospam.com/fr/top.php
http.//www.nospam.com/es/top.php

instead of:

http://www.nospam.com/top.php?l=french
http://www.nospam.com/top.php?l=spanish

Thankyou
Daniel
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 22, 2005, 03:29:03 AM
that what I was trying to explain in my previous reply...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: daniel_74 on April 22, 2005, 04:14:38 AM
Sorry,

I have no idea how to manage to change the language-URLs... :cry:

regards,
Daniel
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: clope on April 23, 2005, 03:40:56 PM
first.. this is a great and effectiv mod ;)
thx chris

i have a question about the Rewrite thing:

for viewing pictures i use the show_img.php:
RewriteRule ^([0-9]+)\/([0-9]+)\/image([0-9]+)\.jpg$ show_img.php?id=$3&time=$1&secureid=$2&%{QUERY_STRING}
RewriteRule ^([0-9]+)\/([0-9]+)\/img([0-9]+)\.htm$ details.php?id=$3&time=$1&secureid=$2&%{QUERY_STRING}

example: http://www.domain.de/1234567/1234567/image123.jpg

works perfectly.. but if show_img.php redirect the user too details.php http://www.domain.de/1234567/1234567/image123.htm
apache load details.php with the wrong path-variable: /1234567/1234567/details.php?...
instead of /details.php?... so no template image could be found.

any ideas how to fix this?

regards, and thanks.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 23, 2005, 05:46:19 PM
that's a tricky part using virtual directories ;) took me probably a week to figure that one out...
try add at the end of .htaccess:
Code: [Select]
RewriteRule ^([0-9]+)\/([0-9]+)\/(.*)$ $3?time=$1&secureid=$2&%{QUERY_STRING}
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Mortekai on April 28, 2005, 01:49:12 AM
I am having problems with the sessions during search as I use the Invision mod and I was wondering if the mod-rewrite could effect that problem in any way?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 28, 2005, 02:35:17 AM
anything is possible...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Mortekai on April 29, 2005, 04:25:36 AM
LOL
Back to trial and error huh?

Let me rephrase....the mod-rewrite, how does it effect the sessions if at all? Does it remove the need for it, alter it, or not at all?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 29, 2005, 04:52:17 AM
mod-rewrite does not affect sessions in any way. But because your 4images is integrated with IPB, the sessions.php most probably was changed and this mod might need to be adjusted as well.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Mortekai on April 30, 2005, 01:53:59 AM
I was afraid you would say something like that.....Anyone know of a skilled programmer willing to do some work for payment? I have some modifications I would like to see done and I could use a good coder to help me out.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: artpics on May 09, 2005, 05:40:11 AM
edited
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on May 09, 2005, 05:45:03 AM
mod rewrite is not supported on your server?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: artpics on May 09, 2005, 05:59:50 AM
thankyou V@no
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Nickerz on May 24, 2005, 04:42:41 AM
I was wondering if anyone had an idea how to implement keyword specifil urls?  While catagory2.htm\product3.htm helps the search engines spider the site it doesnt take SEO into mind.  Keyword spedific urls while not proven, have been clearly noted as having a SE advantage.  www.widgets.com/bluewidgets/trianglewidget.htm statistacally will get better PR than say www.widgets.com/prodx.htm

anyone know to implement that in the code?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: triaphoto on May 26, 2005, 08:44:36 PM
Unfortunately mod_rewrite ist not available by all providers. Strato, a well known german webhoster does not provide mod_rewrite for shared hosting.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: jeromerookie on May 27, 2005, 06:57:12 AM
thank you for this mod who works perfectly.
Is there a solution to have the name of the category / picture in the url? so that it cams to something like that : img447-IMAGE_NAME.htm ???
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on May 27, 2005, 07:49:56 AM
no and it was explaind why many times already ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: drhtm on May 28, 2005, 01:46:44 AM
Is there a way to get the members profile as short urls as well?

For example:
http://www.yoursite.com/member.php?action=showprofile&user_id=1

to

http://www.yoursite.com/Profile1.html

or even better, put the members name like this

http://www.yoursite.com/Profile_Admin.html
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Lain on June 03, 2005, 08:21:18 PM
Is there a way to get the members profile as short urls as well?

For example:
http://www.yoursite.com/member.php?action=showprofile&user_id=1

to

http://www.yoursite.com/Profile1.html


Fr einen "manuellen" aufruf reicht ein

Add. to .htaccess

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


Lain
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Lain on June 03, 2005, 08:24:57 PM
Nun htt ich aber auch noch eine frage.

For example:

V@no

cookies off:
http://gallery.vano.org/en/12027?sessionid=223c17ba0b46b8c145e89a4fb32a589b OK

cookies on:
http://gallery.vano.org/en/12027 OK


Me:

cookies off:
http://localhost/1 --- hmmm ? why. wo ist die sessionid ?

cookies on:
http://localhost/1 OK

kann mir da jemand nen tip geben woran das liegt ? ich denke doch das dies an diesem MOD liegt.

Mfg
Lain
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: drhtm on June 03, 2005, 08:35:44 PM
Is there a way to get the members profile as short urls as well?

For example:
http://www.yoursite.com/member.php?action=showprofile&user_id=1

to

http://www.yoursite.com/Profile1.html


thanks, i got that part, the problem is that i want the entire site to recognize this.

Fr einen "manuellen" aufruf reicht ein

Add. to .htaccess

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


Lain
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Deven316 on June 03, 2005, 09:11:47 PM
Exclellent mod, but I had a queston..

is there anyway to change it to make it where the category is actually in the URL?

like instead of gallery.com/cat5.htm

it can become gallery.com/name-of-category.htm

that'd be sweet and be nice for websites in terms of hits from search engines, eh?

with my luck, its probably impossible to do.. lol

EDIT: i also like in this script how if someone visits the previous URL format (cat=5?id=129), it'll still re-direct them to that image, or whatever, NICE SCRIPT!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on June 03, 2005, 09:40:03 PM
Exclellent mod, but I had a queston..

is there anyway to change it to make it where the category is actually in the URL?

like instead of gallery.com/cat5.htm

it can become gallery.com/name-of-category.htm

that'd be sweet and be nice for websites in terms of hits from search engines, eh?

with my luck, its probably impossible to do.. lol

EDIT: i also like in this script how if someone visits the previous URL format (cat=5?id=129), it'll still re-direct them to that image, or whatever, NICE SCRIPT!

Look, I don't know how many times people have asked this question (maybe you should read this entire thread, again?), but it is still not possible.

And regarding SE's. That really has nothing to do with it. If you know how to optimize properly, both internal and external, you're set. No need for the actual link to be the name of your desired category, trust me on this on.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: drhtm 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?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: kief24 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
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Vincent 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
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: kindian 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?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: kief24 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.

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no 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" ?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu 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.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on July 15, 2005, 03:04:56 AM
1) on some server it is hidden. also it might not exist.
2) yes
3) notepad ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er 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
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on July 16, 2005, 06:49:26 PM
how many times I must repeat this question:

it doesnt work HOW?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on July 16, 2005, 10:28:08 PM
Does it matter "how" it doesn't work?

It just shows the main page.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er 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?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no 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)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er 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)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no 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?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on July 17, 2005, 02:58:23 AM
I see no problem with the code and it worked on my site (tested it).
can u show a link to your site?

Nevermind buddy, suddenly it just started working. Very strange  :roll:

Nevertheless, appreciate your assistance on this matter.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: kindian on July 19, 2005, 12:00:14 PM
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" ?

exactly V@no. It has nothing to do with it. Thats the problem. Ive installed the "Private URL to members profile" MOD. With this mode I have to write the multiviews thing on my htaccess. And when I try to install this google MOD none of the mods work, cause of the htaccess file. Both mods ask for htaccess edit.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on July 19, 2005, 02:47:12 PM
Ive installed the "Private URL to members profile" MOD. With this mode I have to write the multiviews thing on my htaccess.
Why? where did u get the code?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: kindian on July 19, 2005, 07:28:54 PM
Ive installed the "Private URL to members profile" MOD. With this mode I have to write the multiviews thing on my htaccess.
Why? where did u get the code?

it's here http://www.4homepages.de/forum/index.php?topic=7938.0
my htaccess has the multiviews code in it, and when i paste the google MOD code and try, none of the MODS work. Do you think they are non compatible?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on July 20, 2005, 02:27:04 AM
there you go:
instead of the multiviews thing use this:
Code: [Select]
RewriteRule ^who\/.+$ who.php
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: kindian on July 20, 2005, 12:15:28 PM
working. thanks again masta  :D
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on July 20, 2005, 01:31:19 PM
Dunno if you guys have seen this, but it might be worth a look. It's in addition to this MOD:
http://www.4homepages.de/forum/index.php?topic=8940
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on August 07, 2005, 01:29:23 AM
Hi!
I integrated this MOD. I paste the written code into session.php and created a .htaccess file with the posted code.

I receive adresses like this:

http://www.industrie-gravuren.de/galerie/img140.htm

But my pics are not shown. instead of the pic i become an 404 htm error :?: :(

Do you have a idea.
 My hoster is hosteurope. i think that mod rewrite option is enabled.

Attention: My Site is actually set to the original code before including this MOD.

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on August 07, 2005, 06:42:37 AM
try to get access to the error log files, if it says that img140.htm not found, then mod_rewrite is not enabled.
if it sais that details.php can not be found, then you will need to play with RewriteBase / in .htaccess
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on August 07, 2005, 01:25:02 PM
Thanks v@no! I think it is working now.
i got urls like this format: www.industrie-gravuren.de/galerie/img370.htm

Please could you have a look on my site?

1. Is this right that there could not be integrated the image name or cat id instead of for example img370.htm ?
2. i would like to change the url format of my other template pages like it is posted at the bottom of the first page of this thread.
You answered at the top of the second page of this thread to implement a code.
But it is not working for me.
i would like to see www.industrie-gravuren.de/galerie/hilfe_faq.htm
instead of : www.industrie-gravuren.de/galerie/index.php?template=hilfe_faq
Would be kind if you could explain me more specific what i have to change in the .htaccess file :oops: :oops: :oops:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: daniel_74 on August 23, 2005, 11:03:30 PM
Hello,

I know it has been asked seveal times in this topic before, and also it has been given an answer, but I want to give a suggestion for this...

Question is: Can I change the URL: mysite.com/img123.htm to mysite.com/image_name.htm ?

The answer was: NO, because when 2 images have same name, it wont work, the 4images is based on unique ID-Numbers.

Ok, here comes my suggestion:

Could we generate URLs like this instead, so we have still the ID, but were using the image or cat name in the URL, which helps a lot in SEO :

mysite.com/image_name-ID.htm or
mysite.com/image_name/ID.htm

Regards,
Daniel

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on August 24, 2005, 12:14:38 AM
Hello,

I know it has been asked seveal times in this topic before, and also it has been given an answer, but I want to give a suggestion for this...

Question is: Can I change the URL: mysite.com/img123.htm to mysite.com/image_name.htm ?

The answer was: NO, because when 2 images have same name, it wont work, the 4images is based on unique ID-Numbers.

Ok, here comes my suggestion:

Could we generate URLs like this instead, so we have still the ID, but were using the image or cat name in the URL, which helps a lot in SEO :

mysite.com/image_name-ID.htm or
mysite.com/image_name/ID.htm

Regards,
Daniel



Actually, I was thinking the same thing... In theory, it should be doable, but I doubt you can get someone to do it...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: commandos on August 24, 2005, 12:28:00 AM
Hello ,

i have a question that i have been asking for about 1 year and still couldnt get the code for it , its about the category paging issue

when we apply the friendly link mode evrything work perfect except 1 thing wich is the category paging .

the paging is like this : 1 2 Last page

the link on 2 is : 4images/cat54.htm?page=2 and this is dynamic it should be something like this : 4images/cat54_2.htm

can anyone help with this plz ?



also i added this :
Code: [Select]
RewriteRule ^profile([0-9]+)\.htm$ member.php?action=showprofile&user_id=$1&%{QUERY_STRING}
i dident work , do i have 2 edit some php code for this 2 work ?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on August 24, 2005, 01:19:27 AM
the link on 2 is : 4images/cat54.htm?page=2  and this is dynamic it should be something like this : 4images/cat54_2.htm
Another great question! I'd like to know as well!  :mrgreen:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Xyu BAM on August 24, 2005, 06:44:47 AM
that's because 4images parses the link for paging class before it calls the class, then during generating the paging, it simply add page=NN to the url query.
So, if you want it replace url with this mod, you will need find every instances where paging.php is being used, remove parsing the url through $site_sess->url() function and then fix paging.php class to parse every url it created through $site_sess->url() function. I think its a messy process...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: commandos on August 24, 2005, 10:32:43 AM
This issue should really be fixed , just having the category short link is not enough for search engine , even the paging should be friendly link .
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: daniel_74 on August 24, 2005, 01:19:02 PM
Hello,

as my post may be overread, and i think it is important for us all, here again:

Hello,

I know it has been asked seveal times in this topic before, and also it has been given an answer, but I want to give a suggestion for this...

Question is: Can I change the URL: mysite.com/img123.htm to mysite.com/image_name.htm ?

The answer was: NO, because when 2 images have same name, it wont work, the 4images is based on unique ID-Numbers.

Ok, here comes my suggestion:

Could we generate URLs like this instead, so we have still the ID, but were using the image or cat name in the URL, which helps a lot in SEO :

mysite.com/image_name-ID.htm or
mysite.com/image_name/ID.htm

Regards,
Daniel
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: regina on September 08, 2005, 10:55:48 PM
Hello,

as my post may be overread, and i think it is important for us all, here again:

Hello,

I know it has been asked seveal times in this topic before, and also it has been given an answer, but I want to give a suggestion for this...

Question is: Can I change the URL: mysite.com/img123.htm to mysite.com/image_name.htm ?

The answer was: NO, because when 2 images have same name, it wont work, the 4images is based on unique ID-Numbers.

Ok, here comes my suggestion:

Could we generate URLs like this instead, so we have still the ID, but were using the image or cat name in the URL, which helps a lot in SEO :

mysite.com/image_name-ID.htm or
mysite.com/image_name/ID.htm

Regards,
Daniel


yess it is a great...

our admin will creat it i am sure  :wink:

admin please creat it.. this will be a great mod.

Please create it
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: djith on September 09, 2005, 06:31:57 PM
.htaccess is a folder you have to create , ok , in the rootlevel..... Where is this and what is root level ? can somebody explain please...will be very greatfull :)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on September 09, 2005, 07:22:41 PM
-the root folder is the folder where you have installed the 4images files into.
- .htaccess is not a folder it is a file
- do not forget the dot in front of it
- sometimes the file is hidden or you have to create one
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: regina on September 11, 2005, 03:48:56 PM
.will be very greatfull  :wink:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: regina on September 15, 2005, 03:30:09 PM
that's because 4images parses the link for paging class before it calls the class, then during generating the paging, it simply add page=NN to the url query.
So, if you want it replace url with this mod, you will need find every instances where paging.php is being used, remove parsing the url through $site_sess->url() function and then fix paging.php class to parse every url it created through $site_sess->url() function. I think its a messy process...

can u give an example?

can you  :wink:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Maweryk on September 15, 2005, 05:36:42 PM
Great idea!
How can we do that?

My idea:

Category: mysite.com/ID-category_name.htm
Details: mysite.com/ID-category_name-imgID.htm

Thanks for helping!

Cheers,

Markus



Hello,

as my post may be overread, and i think it is important for us all, here again:

Hello,

I know it has been asked seveal times in this topic before, and also it has been given an answer, but I want to give a suggestion for this...

Question is: Can I change the URL: mysite.com/img123.htm to mysite.com/image_name.htm ?

The answer was: NO, because when 2 images have same name, it wont work, the 4images is based on unique ID-Numbers.

Ok, here comes my suggestion:

Could we generate URLs like this instead, so we have still the ID, but were using the image or cat name in the URL, which helps a lot in SEO :

mysite.com/image_name-ID.htm or
mysite.com/image_name/ID.htm

Regards,
Daniel

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: regina on September 17, 2005, 01:18:26 PM
How can we do that?

please help  :oops:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Maweryk on September 19, 2005, 05:02:07 PM
Please, can somebody help us?

Thanks!

Markus
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: djith on September 23, 2005, 11:35:18 PM
Hello, this mod is working for me..... i can have a search engine friendly url.

But with a white page with error 404 , can't fiend page....

what should be the cause and how to find this out ? i think there is something that my server is not accepting, the new url's...maybe it doesn't support this MOD ?

Kindest regards,
Mathew
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on September 24, 2005, 12:12:06 AM
1) made a misstake?
2) provide error logs - then we'll talk ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: djith on September 24, 2005, 12:54:43 AM
Maybe i will get a step closer ... do i have to write the .htaccess in word or another program...? or notepad? ...
i have a   .htaccess.txt   file !! when i rename it to simply   .htaccess  the computer will not recognise the format of the file .....

But i have the short url's :) whit blank pages .....

i leave my site with the error on it ....

www.avatarcorner.com

home is working .... click further into categories.... short url but...... :)

Mathew
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: djith on September 24, 2005, 12:57:56 AM
here i have the settings .....


drwxr-xr-x  11 djith    psacln       4096 Sep 23 22:47 .
dr-xr-xr-x  12 root     apache       4096 Jul 21 01:23 ..
-rw-r--r--   1 djith    psacln        926 Sep 23 22:47 .htaccess    :!:
-rw-r--r--   1 djith    psacln       1621 Aug 16 21:01 Readme.txt
drwxr-xr-x   4 djith    psacln       4096 Aug 16 21:00 admin
drwxr-xr-x   2 djith    psacln       4096 Sep 23 22:45 cache
-rw-r--r--   1 djith    psacln       8698 Sep  7 11:16 categories.php
-rw-r--r--   1 djith    psacln       1831 Aug 16 21:01 config.new.php
-rw-rw-rw-   1 djith    psacln       1871 Aug 16 21:07 config.php
drwxr-xr-x   7 djith    psacln       4096 Sep 23 17:29 data
drwxr-xr-x   6 djith    psacln       4096 Aug 16 20:53 default
-rw-r--r--   1 djith    psacln      27924 Sep  7 11:26 details.php
drwxr-xr-x   2 djith    psacln       4096 Aug 16 20:59 docs
-rw-r--r--   1 djith    psacln      10466 Aug 16 21:01 download.php
drwxr-xr-x   2 djith    psacln       4096 Aug 21 11:16 flag
-rw-r--r--   1 djith    psacln      11991 Aug 16 21:01 global.php
drwxr-xr-x   2 djith    psacln       4096 Sep 23 20:55 includes
-rw-r--r--   1 djith    psacln       8585 Sep  7 11:09 index.php
-rw-r--r--   1 djith    psacln      17248 Aug 16 21:01 install.php
drwxr-xr-x   4 djith    psacln       4096 Aug 16 20:55 lang
-rw-r--r--   1 djith    psacln       8144 Sep  7 10:51 lightbox.php
-rw-r--r--   1 djith    psacln       2956 Aug 16 21:01 login.php
-rw-r--r--   1 djith    psacln       2143 Aug 16 21:01 logout.php
-rw-r--r--   1 djith    psacln      59483 Sep  7 10:58 member.php
-rw-r--r--   1 djith    psacln      15474 Sep  7 10:57 postcards.php
-rw-r--r--   1 djith    psacln      16514 Sep  7 10:57 register.php
-rw-r--r--   1 djith    psacln      15907 Sep  7 10:57 search.php
drwxr-xr-x   4 djith    psacln       4096 Sep 23 17:30 templates
-rw-r--r--   1 djith    psacln      15002 Sep  7 10:57 top.php
-rw-r--r--   1 djith    psacln      15196 Aug 16 21:01 update_1.0_to_1.5.php
-rw-r--r--   1 djith    psacln       9837 Aug 16 21:00 update_1.5_to_1.6.php
-rw-r--r--   1 djith    psacln       4675 Aug 16 21:00 update_1.6.1_to_1.7.php
-rw-r--r--   1 djith    psacln       9895 Aug 16 21:00 update_RC-1_to_RC-2.php


are those correct, especialy .htaccess ?

Mathew
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on September 24, 2005, 05:13:30 AM
notepad is fine


Make sure that mod_rewrite is enabled on your server

As I said, look at the error logs and if it say something like
Quote
file cat123.html does not exists
then it means either mod_rewrite is not enabled, your .htaccess is not set properly.or simply .htaccess is being ignored.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Maweryk on September 27, 2005, 02:03:36 AM
I try it out, but without success. :cry:

@v@no: Can you help us? :roll:

Thanks!

Markus


Great idea!
How can we do that?

My idea:

Category: mysite.com/ID-category_name.htm
Details: mysite.com/ID-category_name-imgID.htm

Thanks for helping!

Cheers,

Markus



Hello,

as my post may be overread, and i think it is important for us all, here again:

Hello,

I know it has been asked seveal times in this topic before, and also it has been given an answer, but I want to give a suggestion for this...

Question is: Can I change the URL: mysite.com/img123.htm to mysite.com/image_name.htm ?

The answer was: NO, because when 2 images have same name, it wont work, the 4images is based on unique ID-Numbers.

Ok, here comes my suggestion:

Could we generate URLs like this instead, so we have still the ID, but were using the image or cat name in the URL, which helps a lot in SEO :

mysite.com/image_name-ID.htm or
mysite.com/image_name/ID.htm

Regards,
Daniel

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: djith on September 30, 2005, 08:39:28 AM
This is over the line, my webhosting service doesn't allow me to use search engine friendly urls !!!!
i asked them to make an .htaccess file for me and this is the answer i got...

Reason enough to brake up with them and transfer my site to another hosting company!!!

Dear Valued Customer,

Thank you for writing us, we would like to inform you that we dont allow
friendly urls this is not supported other .htaccess that are not supported are
as follows:

   AddCharSet
   AddEncoding
   AddLanguage
   AddType
   BrowserMatch
   BrowserMatchNoCase
   CookieTracking
   DefaultLanguage
   DefaultType
   ErrorDocument
   ErrorHeader
   Header
   LanguagePriority
   Options
   PassEnv
   Redirect
   RedirectMatch
   RedirectPermanent
   RedirectTemporary
   SetEnv
   SetEnvIf
   SetEnvIfNoCase
   UnsetEnv

If you want to create .htaccess file you can google for directions and how to
procedures but make sure that the kind of file your going to create is not on
the list.

Thank you for contacting our technical support. If you have any further
questions, please reply to this email leaving all text intact, and be sure to
give us a detailed description of how we can further assist you.
 
Best regards,

Ken
Globat Support
support@globat.com

Web Hosting Made Easy
www.Globat.com
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on September 30, 2005, 02:55:50 PM
That is very common between host companies. mod_rewrite is a quet "havy" on server resources...cant really blame them for not supporting it...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Flo2005 on October 02, 2005, 06:55:42 PM
Hi!

1. I enabled mod_rewrite on my localhost
2. I changed my sessions.php
3. I edited my .htaccess
4. I get this error-message

Quote
Parse error: parse error, expecting `T_FUNCTION' in -> path to my apache-root-folder \lite\includes\sessions.php on line 536

Quote
Line 536 of my sessions.php: define('COOKIE_NAME', '4images_');

Ps: In my .htacces I have allready done - > RewriteBase /lite/

THX

by Flo
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 03, 2005, 05:24:35 AM
You've made a misstake in sessions.php
Restore backups and try again.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Flo2005 on October 03, 2005, 08:38:09 AM
I restored my sessions.php and add the code and became the same error like before :?

I think I have changed something for longer time http://www.vierstra.com/forum/forum-subject.php/t/987 this must have to do with my problem :!: :?: :!: :!:

But, I have comment out this changes...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lapinkulta on October 06, 2005, 08:54:18 PM
Hi V@no!

I have my site in two languages (more to come :-)) and i am using your code from this thread.

How would i need to change it if i would like to have:

./category1_en.htm instead of ./category1.htm?l=english

???

I'm sure you can help me here.

lapinkulta
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 07, 2005, 01:13:03 AM
lets try this:

Replace the code from the original post in sessions.php with this version:
Code: [Select]
/* ORIGINAL CODE
  function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }
*/
  function url($url, $amp = "&amp;") {
    global $l, $user_info;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];
    $url = str_replace('&amp;', '&', $url);
    $ext = "";
/*
  comment out the following lines if you dont want append _<lang> to the filenames. If you do so, you'll need uncomment lines at the end of this function.
*/
    if (!empty($l)) {
      $ext = "_".$l;
    }
/*end commented block*/
    $ext .= ".htm";
    if (!defined('IN_CP')) {
      if (strstr($url, 'index.php')) {
        $url = str_replace('index.php', '', $url);
      }
      elseif (strstr($url, 'search.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('search.php', 'search.'.$matches[1].$ext, $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('search.php', 'search'.$ext, $url);
        }
      }
      elseif (strstr($url, 'lightbox.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('lightbox.php', 'lightbox.'.$matches[1].$ext, $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
                $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('lightbox.php', 'lightbox'.$ext, $url);
        }
      }
      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].$ext, $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].$ext, $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'.$ext, $url);
        }
      }
      elseif (strstr($url, 'details.php?image_id=')) {
        if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
          preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
          if (isset($matches1[1]) && isset($matches2[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php', 'img'.$matches1[1].'.'.$matches2[1].$ext, $url);
            $query = str_replace('image_id='.$matches1[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches1[1], '', $query);
            $query = str_replace('image_id='.$matches1[1], '', $query);
            $query = str_replace('mode='.$matches2[1].'&', '', $query);
            $query = str_replace('&mode='.$matches2[1], '', $query);
            $query = str_replace('mode='.$matches2[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php', 'img'.$matches[1].$ext, $url);
            $query = str_replace('image_id='.$matches[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches[1], '', $query);
            $query = str_replace('image_id='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
      }
      elseif (strstr($url, 'postcards.php?image_id=')) {
        preg_match('#image_id=([0-9]+)&?#', $url, $matches);
        if (isset($matches[1])) {
          $split = explode('?', $url);
          $url = $split[0];
          $query = @$split[1];
          $url   = str_replace('postcards.php', 'postcard.img'.$matches[1].$ext, $url);
          $query = str_replace('image_id='.$matches[1].'&', '', $query);
          $query = str_replace('&image_id='.$matches[1], '', $query);
          $query = str_replace('image_id='.$matches[1], '', $query);
          if (!empty($query)) {
            $url .= '?' . $query;
          }
        }
      }
    }
    if ($this->mode == "get" && strstr($url, $this->session_id)) {
      $url .= strpos($url, '?') !== false ? '&' : '?';
      $url .= SESSION_NAME."=".$this->session_id;
    }
/*
  uncomment the following lines if you want append ?l=<lang>
*/
/*
    if (!empty($l)) {
      $url .= strpos($url, '?') ? '&' : '?';
      $url .= "l=".$l;
    }
*/
    $url = str_replace('&', $amp, $url);
    $url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
    return $url;
  }


Then in .htaccess replace the code with the folowing:
Code: [Select]
# Begin search engine friendly links code
RewriteEngine On
#RewriteBase /
RewriteRule ^lightbox(\.([0-9]+))?(_([a-zA-Z]+))?\.htm$ lightbox.php?page=$2&l=$4&%{QUERY_STRING}

RewriteRule ^search(\.([0-9]+))?(_([a-zA-Z]+))?\.htm$ search.php?page=$2&l=$4&%{QUERY_STRING}

RewriteRule ^cat([0-9]+)?(\.([0-9]+))?(_([a-zA-Z]+))?\.htm$ categories.php?cat_id=$1&page=$3&l=$5&%{QUERY_STRING}

RewriteRule ^img([0-9]+)(\.([a-zA-Z0-9]+))?(_([a-zA-Z]+))?\.htm$ details.php?image_id=$1&mode=$3&l=$5&%{QUERY_STRING}

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

# End search engine friendly links code

Please note, I have not tested it myself and the language name appended to filenames will be the same as the name of your language folders, for example if you have two folders in your /lang/ dir english and deutsch then the filenames will like category1_english.htm or category1_deutsch.htm
If you want it to be shorter, then you'll need to rename your folders ;) (but then dont forget add l=<new name> to the ACP url, otherwise you wont be able get anywhere to update the settings.)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Maweryk on October 07, 2005, 05:37:44 AM
Thanks, vano!!!
It is possible to add the name of the category?

Home/Test

category1_test_english.htm

Thanks!

Markus
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lapinkulta on October 07, 2005, 09:22:05 AM
Hi Vano!

Thanks works great.

Only problem is, that links for the standard language are always generated without the appended language.
So cat1.htm instead of cat1_english.htm

Where could I change that so even for the standard language the string is appended (or the filename correctly written).

Thanks,
lapinkulta
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lapinkulta on October 07, 2005, 09:34:33 AM
OK i have changed:

Code: [Select]
    if (!empty($l)) {
      $ext = "_".$l;
    }

to

Code: [Select]
    if (!empty($l)) {
      $ext = "_".$l;
    }
    if (empty($l)) {
      $ext = "_english";
    }

to have also "_english" appended for the standard language.

What does NOT work:


For the links to lightbox, search, register, member etc. the language (either standard or other, with or without that change above) is not appended...

Greetings,
lapinkulta
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lapinkulta on October 14, 2005, 06:10:34 PM
*bump*
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 14, 2005, 11:17:59 PM
Only problem is, that links for the standard language are always generated without the appended language.
So cat1.htm instead of cat1_english.htm

Where could I change that so even for the standard language the string is appended (or the filename correctly written).
In global.php find:
Code: [Select]
$l = null;
Replace it with:
Code: [Select]
$l = $config['language_dir_default'];
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: G4 on October 15, 2005, 11:27:28 AM
Hi @all,

its some months ago, that i have been here on this forum. my webgallery works fine now, thanks to all of you (especially jan and v@no).
But i got a new serious problem. ive installes mod rewrite and so i got duplicate content in google, now. the biggest problem seems to be the search.htm.

for example:
www.domain.de/search.htm?search_user=G4
www.domain.de/search.php?search_user=G4

or

http://www.domain.de/img1562.search.htm
http://www.domain.de/img1562.htm


i found this in this thread, does this solve my problem?

or another alternative replace in search.php:
Code:
    show_image($image_row, "search");
with:
Code:
    show_image($image_row);
(I think this is better Wink)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 15, 2005, 01:59:00 PM
what EXACTLY is the problem?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: G4 on October 15, 2005, 09:17:24 PM
the problem is, that google has always two versions of every page in the index.
www.domain.de/search.htm?search_user=G4
www.domain.de/search.php?search_user=G4

or

http://www.domain.de/img1562.search.htm
http://www.domain.de/img1562.htm

the problem is the duplicate content, because img1562.htm and img1562.search.htm are exactly the same pages. what can i do against it?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 15, 2005, 10:35:58 PM
nothing really...I had the same problem with images that no longer exists, I've tryed send to search engine bots 404 header - nothing, also I had changed my domain and was permanent redirect when access through old domain (header 301 permanent redirect) - 1 year passed, yahoo still using my old domain...they suck!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lapinkulta on October 17, 2005, 01:41:19 PM
Hi Vano!

I have still problem with the standard links.

cat1_de.htm etc. works fine.

what doesn't work are the links to register, lightbox, search etc.

They should look like "register_de.htm"
but they look like "register.php" now even without the correct language appended.

I understand what you have done to the original code to solve my problem with the ext variable, but I have no idea why these standard links do not work now.

Greetings,
lapinkulta
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 17, 2005, 02:36:08 PM
lightbox? are you sure? register.php is not supported by this code, if you need it, its not that hard to figure it out yourself ;) as of lightbox, I dont know, it should work.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lapinkulta on October 17, 2005, 06:37:20 PM
Yes, it shows only lightbox.htm without the language appended which comes from this code piece:

Code: [Select]
        else {
          $url = str_replace('lightbox.php', 'lightbox.htm', $url);
        }

greetings,
lapinkulta
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 18, 2005, 12:10:03 AM
oh, I've missed these two lines (just upadated the post on previous page).
But you can search for 'search.htm' and 'lightbox.htm' and replace them with 'search'.$ext and 'lightbox'.$ext (be carefull with the quotes!)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lapinkulta on October 19, 2005, 10:49:28 AM
thanks, works great now.  :D
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lotus69 on October 24, 2005, 12:47:31 AM
Hi, i would like to add the image name in the URL like this : www.mydomain.com/img,IMAGE-NAME,id.html

i can do it if i add an argument in the url function like this
Code: [Select]
function url($url, $amp = "&amp;", $name ) {
...
$url = str_replace('details.php', 'img,'.$name.','.$matches[1].'.html', $url);

}


then in details.php, i put this code for previous image link :
Code: [Select]
$prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""),0,$prev_image_name);

but, honnestly, its very boring to change every "$site_sess->url()" to add the third argument, so does anyone have an idea please ?
i would like to do the same for categories and search

thanks for help

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 24, 2005, 02:22:35 AM
use it like this:
Code: [Select]
function url($url, $amp = "&amp;", $name = "" ) {this way the third argument is an optional ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Maweryk on October 24, 2005, 02:37:15 AM
Hi, i would like to add the image name in the URL like this : www.mydomain.com/img,IMAGE-NAME,id.html

i can do it if i add an argument in the url function like this
Code: [Select]
function url($url, $amp = "&amp;", $name ) {
...
$url = str_replace('details.php', 'img,'.$name.','.$matches[1].'.html', $url);

}


then in details.php, i put this code for previous image link :
Code: [Select]
$prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""),0,$prev_image_name);

but, honnestly, its very boring to change every "$site_sess->url()" to add the third argument, so does anyone have an idea please ?
i would like to do the same for categories and search

thanks for help



Nice idea :!:
Can you also post the code for categories?

Thanks a lot!

Cheers,

Markus
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lotus69 on October 24, 2005, 11:49:17 AM
Thanks V@no :)

Maweryk : i haven't code yet, but it's the same thing.
i'll post a reply as soon as i finish

use it like this:
Code: [Select]
function url($url, $amp = "&amp;", $name = "" ) {this way the third argument is an optional ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Matthias70 on October 26, 2005, 06:17:57 PM
Hi V@no,

the Mod Short URL you wrote for lapinkulta here:
http://www.4homepages.de/forum/index.php?topic=6729.msg48487#msg48487

works fine for me, but it affects my control-panel.
When I'm trying to search a user or a picture, I get no results when I'm clicking the search-button.

When I restore the session.php. Search function in control panel is O.K. again...

Do you have an idea, why the search in control panel is affected??

edit: BTW The original Short URL Mod works without problems in the Control Panel  :|

Matthias
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 27, 2005, 12:00:42 AM
I have no clue...I just tryed on a fresh 4images and it worked just fine...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Matthias70 on October 27, 2005, 03:03:21 PM
Hi V@no,
can you test my session.php on your fresh 4images installation?
I added the session.php as a text-file to this message.

Matthias
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 28, 2005, 12:03:06 AM
Seems to work just fine...perhaps something else is interfering...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Matthias70 on October 28, 2005, 02:18:33 PM
Do you have an idea which file/code could interfere :cry:
With the origianal code of this mod erverthing is O.K. only the enxtension for the language-file causes problems in ACP

Matthias
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 29, 2005, 12:15:30 AM
can you pm me with a url / login info so I could test it?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Matthias70 on November 06, 2005, 09:25:35 PM
Hi V@no,
another problem :oops: with this code
http://www.4homepages.de/forum/index.php?topic=6729.msg48487#msg48487

my category_dropdownfield is messed up
The links in the category dropdownfield are nearly O.K. only the catnumber is missing...
So every link in the category dropdownfield looks like
gpaed.de/bildergalerie/cat_english.htm
instead of
gpaed.de/bildergalerie/cat1_english.htm

Matthias
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on November 06, 2005, 09:58:58 PM
the dropdown should add ?cat_id=1 into the url...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Matthias70 on November 06, 2005, 10:03:44 PM
the dropdown should add ?cat_id=1 into the url...

Hm, do you know where I can fix it?
Matthias
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on November 06, 2005, 10:05:19 PM
The request seems to be just fine:
Quote
http://www.gpaed.de/bildergalerie/cat_english.htm

POST /bildergalerie/cat_english.htm HTTP/1.1
Host: www.gpaed.de
Content-Type: application/x-www-form-urlencoded
Content-Length: 9
cat_id=38

:?

Are you sure it worked fine with the original modification?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Matthias70 on November 06, 2005, 10:12:41 PM
Quote from: V@no
Are you sure it worked fine with the original modification?

Just tested it with the original code.
Same Problem in category dropdown? Perhabs the Problem is somewhere else :roll:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on November 06, 2005, 10:18:18 PM
for testing purposes, first open a page where your categories dropdown is, then add this into categories.php
Code: [Select]
echo "<pre>";
print_r($_POST);
print_r($_GET);
exit;
(above)
Code: [Select]
header("Location: ".$site_sess->url(ROOT_PATH."index.php", "&"));Then try to use dropdown. it should show you some text on blank page.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Matthias70 on November 06, 2005, 10:23:10 PM
for testing purposes, first open a page where your categories dropdown is, then add this into categories.php
Code: [Select]
echo "<pre>";
print_r($_POST);
print_r($_GET);
exit;
(above)
Code: [Select]
header("Location: ".$site_sess->url(ROOT_PATH."index.php", "&"));Then try to use dropdown. it should show you some text on blank page.

The text on the blank page is
Code: [Select]
Array
(
[cat_id] => 33
)
Array
(
[cat_id] =>
[page] =>
[l] => deutsch
)

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on November 06, 2005, 10:28:51 PM
Ok, lets call it a bug in 4images itself ;)

for now, in global.php find:
Code: [Select]
  $cat_id = (isset($HTTP_GET_VARS[URL_CAT_ID])) ? intval($HTTP_GET_VARS[URL_CAT_ID]) : intval($HTTP_POST_VARS[URL_CAT_ID]);Replace it with:
Code: [Select]
  $cat_id = (isset($HTTP_POST_VARS[URL_CAT_ID])) ? intval($HTTP_POST_VARS[URL_CAT_ID]) : intval($HTTP_GET_VARS[URL_CAT_ID]);
I'll publish complete fix in few minutes ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Matthias70 on November 06, 2005, 10:34:31 PM
Hi V@no
The URL ist still without cat_number but the fix works great  8)
Thank you V@no
Matthias
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on November 06, 2005, 10:52:05 PM
its "not possible" add cat_id into the url
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Matthias70 on November 13, 2005, 06:27:25 PM
Hi V@no,
another question :oops:
Just the same question but know in the right mod ;-)
I have aklready the extension of this mod you wrote for lapinkulta
http://www.4homepages.de/forum/index.php?topic=6729.msg48487#msg48487

This is my .htacces file
Quote
# Begin search engine friendly links code
RewriteEngine On
#RewriteBase /
RewriteRule ^lightbox(\.([0-9]+))?(_([a-zA-Z]+))?\.htm$ lightbox.php?page=$2&l=$4&%{QUERY_STRING}

RewriteRule ^search(\.([0-9]+))?(_([a-zA-Z]+))?\.htm$ search.php?page=$2&l=$4&%{QUERY_STRING}

RewriteRule ^cat([0-9]+)?(\.([0-9]+))?(_([a-zA-Z]+))?\.htm$ categories.php?cat_id=$1&page=$3&l=$5&%{QUERY_STRING}

RewriteRule ^img([0-9]+)(\.([a-zA-Z0-9]+))?(_([a-zA-Z]+))?\.htm$ details.php?image_id=$1&mode=$3&l=$5&%{QUERY_STRING}

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

# End search engine friendly links code

What do I need to change to rewrite
http://www.gpaed.de/bildergalerie/cat35_deutsch.htm?page=2
to something like this
http://www.gpaed.de/bildergalerie/cat35_2_deutsch.htm

and on the home page to rewrite
http://www.gpaed.de/bildergalerie/?l=deutsch
to something like this
http://www.gpaed.de/bildergalerie/index_deutsch.htm

Matthias
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Matthias70 on November 15, 2005, 04:42:23 PM
Is there no solution for my problem above :?:

Matthias
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on November 18, 2005, 02:13:33 AM
@matthias

could you please send  (pm) your actual .htaccess file for testing on my site.
Because i have also the same problems with the language tags in the URL.
I am interested how it would work on my site.
Perhaps we find a solution together.  :roll:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on November 20, 2005, 03:44:19 PM
@ V@no

Quote
its very easy
here is a specific for privacy.html:
Code:
RewriteRule ^privacy\.html$ index.php?template=privacy&%{QUERY_STRING}and here is "general" that would translate every .html file into index.php?template=<name>
add it at the very end of .htaccess:

Code:
RewriteRule ^([a-zA-Z0-9_-]+)\.html$ index.php?template=$1&%{QUERY_STRING}so it should "translate" blah.html into index.php?template=blah

sorry i am confused. :?

i would like to "translate" index.php?template=blah into  blah.html for all of my menu links you can see on my url .

How must the code look for these?
And also for contact.php, board.php, sitemap.php???

Another strange problem i have still with my category dropdown selection.
It is working in nearley every category except for example the "Skalen", "Formenbau" and "Schilder" category on my URL.
That is strange isn't it?
Could someone help me with this.
I still changed the line like matthias in the global.php. But the mistake still exists.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: salimiali on November 21, 2005, 09:43:32 PM
i have on my gallery root file:

.htaccess
.htaccess.txt

wich is true? (on this files i added this code:)

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

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

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}

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

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

# End search engine friendly links code

and save wtih 2 names, .htaccess and .htaccess.txt (wich is true?) and copy on site.com/gallery/

note: i join from new version of 4images
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Matthias70 on November 21, 2005, 09:45:36 PM
Quote
I have on my gallery root file:

.htaccess
.htaccess.txt

wich is true? (on this files i added this code:)

Use only .htaccess

Matthias
Title: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: salimiali on November 21, 2005, 09:47:31 PM
but nex question:

i not found this source on my sessions.php

Code: [Select]
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
on my file is this source and i can not replace it, found this!!

Code: [Select]
    if ($this->mode == "get" && strpos($url, $this->session_id) === false) {
how i can made replace this code?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on November 21, 2005, 10:34:51 PM
Please could someone help me with my category dropdown problem i have explained in a few postings above.

Quote
Another strange problem i have still with my category dropdown selection.
It is working in nearly every category/subcategory page except for example the "Skalen", "Formenbau" and "Schilder" category on my URL.
That is strange isn't it? On some pages it is working on some it isn't!
Could someone help me with this.
I still changed the line like matthias in the global.php. But the mistake still exists.
Please test it on my site.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on November 22, 2005, 01:05:38 AM
i not found this source on my sessions.php

Code: [Select]
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
what is it you are trying to do? there is no such line in the original topic in the first place.

@bibabobu:
"On some pages it is working on some it isn't" - not very usefull to even start looking at the problem ;) And I see no problem on your site with dropdown for the categories mentioned.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on November 22, 2005, 01:41:56 AM
Dear V@no,

i think since i have installed the new code for search engine friendly URLs and language select my category dropdown field does not work correctly.
Please have a look on my site and test the field in different categories.
Sorry for my bad english i don't find the right words for explaining right at the moment.
For example:
If i go to the main category "Skalen" my category selection field works well. If i want to go to another category right out of this "Skalen" category by using the dropdown category selection field nothing will happen.  :(
...so in some categories the field is working and in some won't.
I have no idea where is the mistake :?:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on November 22, 2005, 02:18:28 AM
I dont think the problem is related to this mod. You have JavaScript errors on your site and since the dropdown menu is using javascript to auto jump to the sellected category it also producing error...The form with category select dropdown on "working" pages and "non working" are identical, but for unknown to me reason this JS error acure:
Quote
Error: forms.jumpbox has no properties
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: TXtaholic on November 22, 2005, 12:31:35 PM
Dear V@no,

i think since i have installed the new code for search engine friendly URLs and language select my category dropdown field does not work correctly.
Please have a look on my site and test the field in different categories.
Sorry for my bad english i don't find the right words for explaining right at the moment.
For example:
If i go to the main category "Skalen" my category selection field works well. If i want to go to another category right out of this "Skalen" category by using the dropdown category selection field nothing will happen. :(
...so in some categories the field is working and in some won't.
I have no idea where is the mistake :?:

well i have the same problem, when  i choose any category and click go it simply goes to the index page!!! when i resorted the orginal code it works like charm? so it seems that maybe i've missed something in code??
note: i use 4images 1.7.1 and i added } as recommend in previous post in order to make it work with 1.7.1 version!!!!!!
the code that i have can be found here!!!

http://www.immsu.com/sessions.phps

please advise!!!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Matthias70 on November 22, 2005, 05:36:42 PM
@ textaholic
I had the same problem!
try this fix
http://www.4homepages.de/forum/index.php?topic=6729.msg50928#msg50928

@ V@no
Back to another problem in this mod
Do you have a solution on this
This is my .htacces file
Quote
# Begin search engine friendly links code
RewriteEngine On
#RewriteBase /
RewriteRule ^lightbox(\.([0-9]+))?(_([a-zA-Z]+))?\.htm$ lightbox.php?page=$2&l=$4&%{QUERY_STRING}

RewriteRule ^search(\.([0-9]+))?(_([a-zA-Z]+))?\.htm$ search.php?page=$2&l=$4&%{QUERY_STRING}

RewriteRule ^cat([0-9]+)?(\.([0-9]+))?(_([a-zA-Z]+))?\.htm$ categories.php?cat_id=$1&page=$3&l=$5&%{QUERY_STRING}

RewriteRule ^img([0-9]+)(\.([a-zA-Z0-9]+))?(_([a-zA-Z]+))?\.htm$ details.php?image_id=$1&mode=$3&l=$5&%{QUERY_STRING}

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

# End search engine friendly links code

What do I need to change to rewrite
http://www.gpaed.de/bildergalerie/cat35_deutsch.htm?page=2
to something like this
http://www.gpaed.de/bildergalerie/cat35_2_deutsch.htm

and on the home page to rewrite
http://www.gpaed.de/bildergalerie/?l=deutsch
to something like this
http://www.gpaed.de/bildergalerie/index_deutsch.htm

Matthias

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: salimiali on November 23, 2005, 07:38:47 AM
this is my sessions.php file on includes:

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: sessions.php                                         *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.1                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) fr weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
if (!defined('ROOT_PATH')) {
  die(
"Security violation");
}

//-----------------------------------------------------
//--- Start Configuration -----------------------------
//-----------------------------------------------------

define('SESSION_NAME''sessionid');

$user_table_fields = array(
  
"user_id" => "user_id",
  
"user_level" => "user_level",
  
"user_name" => "user_name",
  
"user_password" => "user_password",
  
"user_email" => "user_email",
  
"user_showemail" => "user_showemail",
  
"user_allowemails" => "user_allowemails",
  
"user_invisible" => "user_invisible",
  
"user_joindate" => "user_joindate",
  
"user_activationkey" => "user_activationkey",
  
"user_lastaction" => "user_lastaction",
  
"user_location" => "user_location",
  
"user_lastvisit" => "user_lastvisit",
  
"user_comments" => "user_comments",
  
"user_homepage" => "user_homepage",
  
"user_icq" => "user_icq"
);

//-----------------------------------------------------
//--- End Configuration -------------------------------
//-----------------------------------------------------

function get_user_table_field($add$user_field) {
  global 
$user_table_fields;
  return (!empty(
$user_table_fields[$user_field])) ? $add.$user_table_fields[$user_field] : "";
}

class 
Session {

  var 
$session_id;
  var 
$user_ip;
  var 
$user_location;
  var 
$current_time;
  var 
$session_timeout;
  var 
$mode "get";
  var 
$session_info = array();
  var 
$user_info = array();

  function 
Session() {
    global 
$config;
    
$this->session_timeout $config['session_timeout'] * 60;
    
$this->user_ip $this->get_user_ip();
    
$this->user_location $this->get_user_location();
    
$this->current_time time();

    
// Stop adding SID to URLs
    
@ini_set('session.use_trans_sid'0);

    
session_name(urlencode(SESSION_NAME));
    
session_start();

    
$this->demand_session();
  }

  function 
set_cookie_data($name$value$permanent 1) {
    
$cookie_expire = ($permanent) ? $this->current_time 60 60 24 365 0;
    
$cookie_name COOKIE_NAME.$name;
    
setcookie($cookie_name$value$cookie_expireCOOKIE_PATHCOOKIE_DOMAINCOOKIE_SECURE);
  }

  function 
read_cookie_data($name) {
    global 
$HTTP_COOKIE_VARS;
    
$cookie_name COOKIE_NAME.$name;
    return (isset(
$HTTP_COOKIE_VARS[$cookie_name])) ? $HTTP_COOKIE_VARS[$cookie_name] : false;
  }

  function 
get_session_id() {
    if (
SID == '') {
      
$this->mode "cookie";
    }

    
$this->session_id session_id();
  }

  function 
demand_session() {
    
$this->get_session_id();
    if (!
$this->load_session_info()) {
      
$this->delete_old_sessions();
      
$user_id = ($this->read_cookie_data("userid")) ? intval($this->read_cookie_data("userid")) : GUEST;
      
$this->start_session($user_id);
    }
    else {
      
$this->user_info $this->load_user_info($this->session_info['session_user_id']);
      
$update_cutoff = ($this->user_info['user_id'] != GUEST) ? $this->current_time $this->user_info['user_lastaction'] : $this->current_time $this->session_info['session_lastaction'];
      if (
$update_cutoff 60) {
        
$this->update_session();
        
$this->delete_old_sessions();
      }
    }
  }

  function 
start_session($user_id GUEST$login_process 0) {
    global 
$site_db;

    
$this->user_info $this->load_user_info($user_id);
    if (
$this->user_info['user_id'] != GUEST && !$login_process) {
      if (
$this->read_cookie_data("userpass") === $this->user_info['user_password'] && $this->user_info['user_level'] > USER_AWAITING) {
        
$this->set_cookie_data("userpass"$this->user_info['user_password']);
      }
      else {
        
$this->set_cookie_data("userpass"""0);
        
$this->user_info $this->load_user_info(GUEST);
      }
    }

    
//if (!$login_process) {
      
$sql "REPLACE INTO ".SESSIONS_TABLE."
              (session_id, session_user_id, session_lastaction, session_location, session_ip)
              VALUES
              ('
$this->session_id', ".$this->user_info['user_id'].", $this->current_time, '$this->user_location', '$this->user_ip')";
      
$site_db->query($sql);
    
//}

    
$this->session_info['session_user_id'] = $this->user_info['user_id'];
    
$this->session_info['session_lastaction'] = $this->current_time;
    
$this->session_info['session_location'] = $this->user_location;
    
$this->session_info['session_ip'] = $this->user_ip;

    if (
$this->user_info['user_id'] != GUEST) {
      
$this->user_info['user_lastvisit'] = (!empty($this->user_info['user_lastaction'])) ? $this->user_info['user_lastaction'] : $this->current_time;
      
$sql "UPDATE ".USERS_TABLE."
              SET "
.get_user_table_field("""user_lastaction")." = $this->current_time, ".get_user_table_field("""user_location")." = '$this->user_location', ".get_user_table_field("""user_lastvisit")." = ".$this->user_info['user_lastvisit']."
              WHERE "
.get_user_table_field("""user_id")." = ".$this->user_info['user_id'];
      
$site_db->query($sql);
    }
    
$this->set_cookie_data("lastvisit"$this->user_info['user_lastvisit']);
    
$this->set_cookie_data("userid"$this->user_info['user_id']);
    return 
true;
  }

  function 
login($user_name ""$user_password ""$auto_login 0$set_auto_login 1) {
    global 
$site_db$user_table_fields;

    if (empty(
$user_name) || empty($user_password)) {
      return 
false;
    }
    
$sql "SELECT ".get_user_table_field("""user_id").get_user_table_field(", ""user_password")."
            FROM "
.USERS_TABLE."
            WHERE "
.get_user_table_field("""user_name")." = '$user_name' AND ".get_user_table_field("""user_level")." <> ".USER_AWAITING;
    
$row $site_db->query_firstrow($sql);

    
$user_id = (isset($row[$user_table_fields['user_id']])) ? $row[$user_table_fields['user_id']] : GUEST;
    
$user_password md5($user_password);
    if (
$user_id != GUEST) {
      if (
$row[$user_table_fields['user_password']] == $user_password) {
        
$sql "UPDATE ".SESSIONS_TABLE."
                SET session_user_id = 
$user_id
                WHERE session_id = '
$this->session_id'";
        
$site_db->query($sql);
        if (
$set_auto_login) {
          
$this->set_cookie_data("userpass", ($auto_login) ? $user_password "");
        }
        
$this->start_session($user_id1);
        return 
true;
      }
    }
    return 
false;
  }

  function 
logout($user_id) {
    global 
$site_db;
    
$sql "DELETE FROM ".SESSIONS_TABLE."
            WHERE session_id = '
$this->session_id' OR session_user_id = $user_id";
    
$site_db->query($sql);
    
$this->set_cookie_data("userpass"""0);
    
$this->set_cookie_data("userid"GUEST);

    
$this->session_info = array();

    return 
true;
  }

  function 
delete_old_sessions() {
    global 
$site_db;
    
$expiry_time $this->current_time $this->session_timeout;
    
$sql "DELETE FROM ".SESSIONS_TABLE."
            WHERE session_lastaction < 
$expiry_time";
    
$site_db->query($sql);

    return 
true;
  }

  function 
update_session() {
    global 
$site_db;

    
$sql "UPDATE ".SESSIONS_TABLE."
            SET session_lastaction = 
$this->current_time, session_location = '$this->user_location'
            WHERE session_id = '
$this->session_id'";
    
$site_db->query($sql);

    
$this->session_info['session_lastaction'] = $this->current_time;
    
$this->session_info['session_location'] = $this->user_location;
    
$this->session_info['session_ip'] = $this->user_ip;

    if (
$this->user_info['user_id'] != GUEST) {
      
$sql "UPDATE ".USERS_TABLE."
              SET "
.get_user_table_field("""user_lastaction")." = $this->current_time, ".get_user_table_field("""user_location")." = '$this->user_location'
              WHERE "
.get_user_table_field("""user_id")." = ".$this->user_info['user_id'];
      
$site_db->query($sql);
    }
    return;
  }

  function 
generate_session_id() {
    return 
session_id();
  }

  function 
return_session_info() {
    return 
$this->session_info;
  }

  function 
return_user_info() {
    return 
$this->user_info;
  }

  function 
freeze() {
    return;
  }

  function 
load_session_info() {
    if (@
ini_get('register_globals')) {
      
session_register('__session');

      if (!isset(
$GLOBALS['__session'])) {
        
$GLOBALS['__session'] = array();
      }

      
$this->session_info = &$GLOBALS['__session'];

    } else {
      if (isset(
$_SESSION)) {
        if (!isset(
$_SESSION['__session'])) {
          
$_SESSION['__session'] = array();
        }

        
$this->session_info = &$_SESSION['__session'];

      } else {
        if (!isset(
$GLOBALS['HTTP_SESSION_VARS']['__session'])) {
          
$GLOBALS['HTTP_SESSION_VARS']['__session'] = array();
        }

        
$this->session_info = &$GLOBALS['HTTP_SESSION_VARS']['__session'];
      }
    }

    if (!isset(
$this->session_info['session_user_id'])) {
        return 
false;
    }

    return 
$this->session_info;
  }

  function 
load_user_info($user_id GUEST) {
    global 
$site_db$user_table_fields;

    if (
$user_id != GUEST) {
      
$sql "SELECT u.*, l.*
              FROM "
.USERS_TABLE." u, ".LIGHTBOXES_TABLE." l
              WHERE "
.get_user_table_field("u.""user_id")." = $user_id AND l.user_id = ".get_user_table_field("u.""user_id");
      
$user_info $site_db->query_firstrow($sql);
      if (!
$user_info) {
        
$sql "SELECT *
                FROM "
.USERS_TABLE."
                WHERE "
.get_user_table_field("""user_id")." = $user_id";
        
$user_info $site_db->query_firstrow($sql);
        if (
$user_info) {
          
$lightbox_id get_random_key(LIGHTBOXES_TABLE"lightbox_id");
          
$sql "INSERT INTO ".LIGHTBOXES_TABLE."
                  (lightbox_id, user_id, lightbox_lastaction, lightbox_image_ids)
                  VALUES
                  ('
$lightbox_id', ".$user_info[$user_table_fields['user_id']].", $this->current_time, '')";
          
$site_db->query($sql);
          
$user_info['lightbox_lastaction'] = $this->current_time;
          
$user_info['lightbox_image_ids'] = "";
        }
      }
    }
    if (empty(
$user_info[$user_table_fields['user_id']])) {
      
$user_info = array();
      
$user_info['user_id'] = GUEST;
      
$user_info['user_level'] = GUEST;
      
$user_info['user_lastaction'] = $this->current_time;
      
$user_info['user_lastvisit'] = ($this->read_cookie_data("lastvisit")) ? $this->read_cookie_data("lastvisit") : $this->current_time;
    }
    foreach (
$user_table_fields as $key => $val) {
      if (isset(
$user_info[$val])) {
        
$user_info[$key] = $user_info[$val];
      }
      elseif (!isset(
$user_info[$key])) {
        
$user_info[$key] = "";
      }
    }
    return 
$user_info;
  }

  function 
set_session_var($var_name$value) {
    
$this->session_info[$var_name] = $value;
    return 
true;
  }

  function 
get_session_var($var_name) {
    if (isset(
$this->session_info[$var_name])) {
      return 
$this->session_info[$var_name];
    }

    return 
'';
  }

  function 
drop_session_var($var_name) {
    unset(
$this->session_info[$var_name]);
  }

  function 
get_user_ip() {
    global 
$HTTP_SERVER_VARS$HTTP_ENV_VARS;
    
$ip = (!empty($HTTP_SERVER_VARS['REMOTE_ADDR'])) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ((!empty($HTTP_ENV_VARS['REMOTE_ADDR'])) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv("REMOTE_ADDR"));
    
$ip preg_replace("/[^\.0-9]+/"""$ip);
    return 
substr($ip050);
  }

  function 
get_user_location() {
    global 
$self_url;
    return (
defined("IN_CP")) ? "Control Panel" preg_replace(array("/([?|&])action=[^?|&]*/""/([?|&])mode=[^?|&]*/""/([?|&])phpinfo=[^?|&]*/""/([?|&])printstats=[^?|&]*/""/[?|&]".URL_ID."=[^?|&]*/""/[?|&]l=[^?|&]*/""/[&?]+$/"), array(""""""""""""""), addslashes($self_url));
  }

  function 
url($url$amp "&amp;") {
    global 
$l;
    
$dummy_array explode("#"$url);
    
$url $dummy_array[0];

    if (
$this->mode == "get" && strpos($url$this->session_id) === false) {
      
$url .= strpos($url'?') !== false $amp "?";
      
$url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty(
$l)) {
      
$url .= strpos($url'?') !== false $amp "?";
      
$url .= "l=".$l;
    }

    
$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return 
$url;
  }
//end of class

//-----------------------------------------------------
//--- Start Session -----------------------------------
//-----------------------------------------------------
define('COOKIE_NAME''4images_');
define('COOKIE_PATH''/');
define('COOKIE_DOMAIN''');
define('COOKIE_SECURE''0');

$site_sess = new Session();

// Get Userinfo
$session_info $site_sess->return_session_info();
$user_info $site_sess->return_user_info();

//-----------------------------------------------------
//--- Get User Caches ---------------------------------
//-----------------------------------------------------
$num_total_online 0;
$num_visible_online 0;
$num_invisible_online 0;
$num_registered_online 0;
$num_guests_online 0;
$user_online_list "";
$prev_user_ids = array();
$prev_session_ips = array();

if (
defined("GET_USER_ONLINE") && ($config['display_whosonline'] == || $user_info['user_level'] == ADMIN)) {
  
$time_out time() - 300;
  
$sql "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.""user_id").get_user_table_field(", u.""user_level").get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_invisible")."
  FROM "
.SESSIONS_TABLE." s
  LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = s.session_user_id)
  WHERE s.session_lastaction >= 
$time_out
  ORDER BY "
.get_user_table_field("u.""user_id")." ASC, s.session_ip ASC";
  
$result $site_db->query($sql);
  while (
$row $site_db->fetch_array($result)) {
    if (
$row['session_user_id'] != GUEST && (isset($row['user_id']) && $row['user_id'] != GUEST)) {
      if (!isset(
$prev_user_ids[$row['session_user_id']])) {
        
$is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 0;
        
$invisibleuser = ($is_invisible) ? "*" "";
        
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1) ? sprintf("<b>%s</b>"$row[$user_table_fields['user_name']]) : $row[$user_table_fields['user_name']];
        if (!
$is_invisible || $user_info['user_level'] == ADMIN) {
          
$user_online_list .= ($user_online_list != "") ? ", " "";
          
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/"$row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$row['session_user_id'];
          
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;
        }
        (!
$is_invisible) ? $num_visible_online++ : $num_invisible_online++;
        
$num_registered_online++;
      }
      
$prev_user_ids[$row['session_user_id']] = 1;
    }
    else {
      if (!isset(
$prev_session_ips[$row['session_ip']])) {
        
$num_guests_online++;
      }
    }
    
$prev_session_ips[$row['session_ip']] = 1;
  }
  
$num_total_online $num_registered_online $num_guests_online;
  
//$num_invisible_online = $num_registered_online - $num_visible_online;

  
$site_template->register_vars(array(
    
"num_total_online" => $num_total_online,
    
"num_invisible_online" => $num_invisible_online,
    
"num_registered_online" => $num_registered_online,
    
"num_guests_online" => $num_guests_online,
    
"user_online_list" => $user_online_list,
    
"lang_user_online" => str_replace('{num_total_online}'$num_total_online$lang['user_online']),
    
"lang_user_online_detail" => str_replace(array('{num_registered_online}','{num_invisible_online}','{num_guests_online}'), array($num_registered_online,$num_invisible_online,$num_guests_online), $lang['user_online_detail']),
  ));
  
$whos_online $site_template->parse_template("whos_online");
  
$site_template->register_vars("whos_online"$whos_online);
  unset(
$whos_online);
  unset(
$prev_user_ids);
  unset(
$prev_session_ips);
}
?>

i can not find this line on my sessions.php for replace with new source (why?):

Code: [Select]
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on November 23, 2005, 07:48:35 AM
i can not find this line on my sessions.php for replace with new source (why?):

Code: [Select]
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
for what? see, the original code has no such line in the instructions, yet you are keep asking same question over and over again without any references to what code you are trying to install/change.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: abdoh2010 on November 24, 2005, 07:08:00 AM
how to insert search.php?search_keywords in the url friendly ?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Maweryk on November 24, 2005, 07:30:22 AM
how to insert search.php?search_keywords in the url friendly ?

http://www.4homepages.de/forum/index.php?topic=6729.msg30784#msg30784

Gru

Markus
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Maweryk on November 24, 2005, 08:08:26 PM
Hi, i would like to add the image name in the URL like this : www.mydomain.com/img,IMAGE-NAME,id.html

i can do it if i add an argument in the url function like this
Code: [Select]
function url($url, $amp = "&", $name ) {
...
$url = str_replace('details.php', 'img,'.$name.','.$matches[1].'.html', $url);

}


then in details.php, i put this code for previous image link :
Code: [Select]
$prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&mode=".$mode : ""),0,$prev_image_name);

but, honnestly, its very boring to change every "$site_sess->url()" to add the third argument, so does anyone have an idea please ?
i would like to do the same for categories and search

thanks for help



Do you have finished it for categories?
I have no success. :(
I get only category-,,223.htm.

Cheers,

Markus
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: abdoh2010 on November 24, 2005, 08:42:41 PM
i am not talking about that

i am talking about sessions.php changes
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: abdoh2010 on November 26, 2005, 07:22:40 AM
how to insert search.php?search_keywords in the url friendly ?

any one please ?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Schaum on November 28, 2005, 12:16:46 PM
Hello,
I have added this great mod, but I have a small understanding problem.
How know a search machine the other language sites?

To change the language, you must klick, on the Banner.
But I have like theses links:
Code: [Select]
categories.php?cat_id=39&page=&l=englishor the index:
Code: [Select]
?l=english
Normally the search engine is stopp ? here.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on November 28, 2005, 03:01:19 PM
This has been discused here, quiet recently. I see no point repeat the discussion again.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on November 30, 2005, 09:48:33 PM
@ v@no
sorry, back to my (and txtaholics) category dropdown selection menu problem.
It is still working on some pages and on some pages it will not work. I have not an idea where is the mistake.
I have repaired all IE errors i had on my site but it is still not working on every page onlyon some. (please try on my site)

Even one more question:
I have put this code to my .htaccess file
Code: [Select]
RewriteRule ^([a-zA-Z0-9_-]+)\.html$ index.php?template=$1&%{QUERY_STRING}for having this
www.industrie-gravuren.de/galerie/anfahrt.html
instead of this
www.industrie-gravuren.de/galerie/index.php?template=anfahrt
for example.
What i am doing wrong? It is not working for me.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Maweryk on November 30, 2005, 10:19:08 PM
Hi,

mit dieser Regel klappt das auf jeden Fall bei mir und mit den Kategorien habe ich auch keine Probleme.
Wie sieht denn Dein ganzes .htaccess File aus und bei welchen Kategorien klappt es nicht?

Gru

Markus
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on December 01, 2005, 01:03:31 AM
I dont think the problem is related to this mod. You have JavaScript errors on your site and since the dropdown menu is using javascript to auto jump to the sellected category it also producing error...The form with category select dropdown on "working" pages and "non working" are identical, but for unknown to me reason this JS error acure:
Quote
Error: forms.jumpbox has no properties
Lets do one step at a time: fix the javascript errors, then if the problem remains, we'll continue troubleshoot.

As of your custom template setup, the sign minus ( - ) must be escaped with a backslash:
Quote
RewriteRule ^([a-zA-Z0-9_\-]+)\.html$ index.php?template=$1&%{QUERY_STRING}
And make sure that this line is the last in .htaccess, otherwise every page you access would be treated as a custom template ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on December 01, 2005, 07:42:21 AM
@ v@no
Thanks v@no.
Quote
Lets do one step at a time: fix the javascript errors, then if the problem remains, we'll continue troubleshoot.
How can find or see the javascript errors. I am using IE. In the status line there is no error to see.
Could you please help me to find. Thanks.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Maweryk on December 01, 2005, 07:48:11 AM
@ v@no
Thanks v@no.
Quote
Lets do one step at a time: fix the javascript errors, then if the problem remains, we'll continue troubleshoot.
How can find or see the javascript errors. I am using IE. In the status line there is no error to see.
Could you please help me to find. Thanks.

Zeile:321
Zeichen:21
Code:0
Fehler:'{' erwartet
URL:http://www.industrie-gravuren.de/galerie/img206.htm

Zeile:621
Zeichen:21
Code:0
Fehler:'{' erwartet
URL:http://www.industrie-gravuren.de/galerie/cat9.htm

Zeile:690
Zeichen:21
Code:0
Fehler:'{' erwartet
URL:http://www.industrie-gravuren.de/galerie/

...

Gru

Markus
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on December 01, 2005, 08:13:04 AM
Use Firefox - it has exelent JS debuging tool
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on December 01, 2005, 10:01:23 PM
 8O
 still not working on the end of my .htaccess file.
Code: [Select]
RewriteRule ^([a-zA-Z0-9_\-]+)\.html$ index.php?template=$1&%{QUERY_STRING}something is going wrong. i don't know why :?:

@ v@no thanks i will install firefox perhaps it is helping me to repair the javascripts.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on December 02, 2005, 12:23:18 AM
Just tested myself - works just fine.


[EDIT]
are you sure thats the exact line from your .htaccess? cause link with .htm extension instead of .html works just fine:
http://www.industrie-gravuren.de/galerie/anfahrt.htm
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on December 02, 2005, 11:19:27 PM
hi v@no,

i found out my problem.
In my javascript for my site link menu there were the links in php style. I changed that into html links.
Now it is working fine :mrgreen:

Just one link in german language, the "kleinanzeiger" the rewrite does not work and i don't know why.
I changed it like i changed the other links. For surprise in the other languages this "kleinanzeiger" link also works great. :roll: :?:

EDIT:
I have installed Mozilla Firefox. And i already repaired some template problems.
Also i can find the Javascript problems. But i cannot fix them.
What a pity that i don't know how :?:
Perhaps you could help me to fix one error, so that i could repair the other errors on my own :roll:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lotus69 on December 04, 2005, 03:29:01 PM
Hi, for those who wants to have furl like this :
www.yourdomain.com/image-image,name,id.html
www.yourdomain.com/categorie-categorie,name,id,page.html
www.yourdomain.com/recherche-name,page.html
www.yourdomain.com/nouvelles-images,1,page.html

(you can see it on my web site : www.yatahonga.com (http://www.yatahonga.com))

first : in sessions.php
find the url function and replace it by :
Code: [Select]
function good_name($nom) {

$nom = str_replace(' ', ',', $nom);
$nom = str_replace('_', ',', $nom);
$nom = str_replace('--', ',', $nom);
$nom = str_replace('---', ',', $nom);
$nom = str_replace(',,', ',', $nom);
$nom = str_replace(',,,', ',', $nom);

$nom = str_replace('&', '', $nom);
$nom = str_replace('', '', $nom);
$nom = str_replace('~', '', $nom);
$nom = str_replace('', '', $nom);
$nom = str_replace('+', '', $nom);
$nom = str_replace('=', '', $nom);

$accent = "";
$noaccent = "aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyyby";
$nom = strtr(trim($nom),$accent,$noaccent);

return $nom;

}




function url($url, $amp = "&amp;", $nom = "" ) {
global $l, $user_info;

// on enleve les caracteres spciaux du nom

$nom=$this->good_name($nom);


$dummy_array = explode("#", $url);
$url = $dummy_array[0];
$url = str_replace('&amp;', '&', $url);




if (!defined('IN_CP')) {
if (strstr($url, 'index.php')) {
$url = str_replace('index.php', '', $url);
}

// POUR LA PAGE SEARCH.PHP
elseif (strstr($url, 'search.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('search.php', 'recherche-images,'.$matches[1].'.html', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else if (strstr($url, 'search_new_images=')) {
preg_match('#search_new_images=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('search.php', 'nouvelles-images,'.$matches[1].'.html', $url);
}
}
else if (strstr($url, 'search_keywords=')) {

//echo "<br>JE SUIS DS SEARCH KEYWORDS<br>";

preg_match('#search_keywords=(.*)&?#', $url, $matches);
if (isset($matches[1])) {

//echo "<br>JE detecte les matchs : ".$matches[1]."<br>";

$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];

//echo "<br>QUERY : ".$query[1]."<br>";

$url = str_replace('search.php', 'recherche-images,'.$matches[1].'.html', $url);
}
}
else {
$url = str_replace('search.php', 'recherche-images.html', $url);
}
}

// POUR LA PAGE SEARCH_STATS.PHP
 
elseif (strstr($url, 'search_stats.php')) {
$url = str_replace('search_stats.php', 'recherches-statistiques.html', $url);
}


// POUR LA PAGE CATEGORIE.PHP

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', 'categorie-'.$nom.','.$matches1[1].','.$matches2[1].'.html', $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', 'categorie-'.$nom.','.$matches[1].'.html', $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.html', $url);
}
}

// POUR LA PAGE DETAILS.PHP

elseif (strstr($url, 'details.php?image_id=')) {
if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php','image-'.$nom.','.$matches1[1].'.'.$matches2[1].'.html', $url);
$query = str_replace('image_id='.$matches1[1].'&', '', $query);
$query = str_replace('&image_id='.$matches1[1], '', $query);
$query = str_replace('image_id='.$matches1[1], '', $query);
$query = str_replace('mode='.$matches2[1].'&', '', $query);
$query = str_replace('&mode='.$matches2[1], '', $query);
$query = str_replace('mode='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php','image-'.$nom.','.$matches[1].'.html', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
}
if ($this->mode == "get" && strstr($url, $this->session_id)) {
$url .= strpos($url, '?') !== false ? '&' : '?';
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= strpos($url, '?') ? '&' : '?';
$url .= "l=".$l;
}
$url = str_replace('&', $amp, $url);
$url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
return $url;
}

// *************************************************************
// FIN URL REWRITING
// *************************************************************

Note that if you want others statics words, you have to change the differents str_replace for search, details and categories

STEP 2 : in functions.php

wherevever you see :
$site_sess->url(ROOT_PATH."details.php?"
AND
$site_sess->url(ROOT_PATH."categories.php?"

just add the thir agurment wich is the cat or image name of course !
ex :

in function get_thumbnail_code(), for the condition if ($showlink), i set :
$thumb = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""),0,$image_name)."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a>";

STEP 3 : paging.php

replace it by this :
Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: paging.php                                           *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7                                                  *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) fr weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
if (!defined('ROOT_PATH')) {
  die(
"Security violation");
}

class 
Paging {
  var 
$page,$offset,$perpage,$num_rows_all,$link_args;
  var 
$first,$last,$total_pages,$config,$desc,$next,$back;

  function 
Paging($page 1$perpage 0$num_rows_all 0$link_args "") {
    global 
$lang$config;

    
$this->page $page;
    
$this->perpage $perpage;
    
$this->num_rows_all $num_rows_all;

    if (!isset(
$this->page) || !intval($this->page)) {
      
$this->page 1;
    }
    if (!
$this->num_rows_all) {
      
$this->total_pages 0;
    }
    elseif (
$this->num_rows_all <= $this->perpage) {
      
$this->total_pages 1;
    }
    elseif (
$this->num_rows_all $this->perpage == 0) {
      
$this->total_pages $this->num_rows_all $this->perpage;
    }
    else {
      
$this->total_pages ceil($this->num_rows_all $this->perpage);
    }
    if (
$this->page $this->total_pages) {
      
$this->page 1;
    }
    if (!
$this->num_rows_all) {
      
$this->first 0;
    }
    else {
      
$this->first $this->perpage $this->page $this->perpage 1;
    }
    if (!
$this->num_rows_all) {
      
$this->last 0;
    }
    elseif (
$this->page == $this->total_pages) {
      
$this->last $this->num_rows_all;
    }
    else {
      
$this->last $this->perpage $this->page;
    }

    
$this->offset $this->perpage $this->page $this->perpage;

    
$link_args ereg_replace("&page=[0-9]*"""$link_args);
    
$link_args ereg_replace("page=[0-9]*&"""$link_args);
    
$this->link_args basename($link_args);
    
$this->link_args .= preg_match("/\?/",$this->link_args) ? "&amp;" "?";

    
$this->desc $lang['paging_stats'];
    
$this->paging_next $lang['paging_next'];
    
$this->paging_back $lang['paging_previous'];
    
$this->paging_lastpage $lang['paging_lastpage'];
    
$this->paging_firstpage $lang['paging_firstpage'];
    
$this->range $config['paging_range'];
  }


// fct utile pour l'url rewriting
function good_page($url){

// on explode la chaine sur .
$url explode (".",$url);

//on ne renvoit que l'url sans le .html

return $url[0];
}




  function 
get_paging() {
    
$html "";
    if (
$this->total_pages 1) {
      
$page_back $this->page 1;
      
$page_next $this->page 1;

      if (
$page_back 0) {
        
$html .= "<a href=\"".$this->good_page($this->link_args).",1.html\" class=\"paging\">".$this->paging_firstpage."</a>&nbsp;&nbsp;";
        
$html .= "<a href=\"".$this->good_page($this->link_args).",$page_back.html\" class=\"paging\">".$this->paging_back."</a>&nbsp;&nbsp;";
      }
      for (
$page_num 1$page_num <= $this->total_pages$page_num++) {
        if (
$page_num >= ($this->page-$this->range) && $page_num <= ($this->page+$this->range)) {
          if (
$this->page == $page_num) {
            
$html .= "<b class=\"pagingon\">$page_num</b>&nbsp;&nbsp;";
          }
          else {
            
$html .= "<a href=\"".$this->good_page($this->link_args).",$page_num.html\" class=\"paging\">$page_num</a>&nbsp;&nbsp;";
          }
        }
      }
      if (
$page_next <= $this->total_pages) {
        
$html .= "<a href=\"".$this->good_page($this->link_args).",$page_next.html\" class=\"paging\">".$this->paging_next."</a>&nbsp;&nbsp;";
        
$html .= "<a href=\"".$this->good_page($this->link_args).",$this->total_pages.html\" class=\"paging\">".$this->paging_lastpage."</a>";
      }
    }
    return 
$html;
  }

  function 
get_offset() {
    return 
$this->offset;
  }

  function 
get_paging_stats() {
    global 
$site_template;
    
$search_array = array(
      
"/".$site_template->start."total_cat_images".$site_template->end."/iU",
      
"/".$site_template->start."total_pages".$site_template->end."/iU",
      
"/".$site_template->start."first_page".$site_template->end."/iU",
      
"/".$site_template->start."last_page".$site_template->end."/iU"
    
);
    
$replace_array = array(
      
$this->num_rows_all,
      
$this->total_pages,
      
$this->first,
      
$this->last
    
);
    
$this->desc preg_replace($search_array$replace_array$this->desc);
    return 
$this->desc;
  }
//end of class
?>


STEP 4 :  categories.php


in section SHOW IMAGE, juste replace

the $linkarg definition by :
$link_arg = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id,0,$cat_cache[$cat_id]['cat_name']);
( i just add the cat name ;) )


STEP 5 :  details.php


for next and prev image url, just add the name of the image like this :
Code: [Select]
$next_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""),0,$next_image_name);
Code: [Select]
$prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""),0,$prev_image_name);

STEP 6 : search_form.html (template) and header.html (template too...)

for the form, add this : onsubmit="return form_url(this.search_keywords.value); "
(its a redirection function in order to get the name of the query

then add in your header this javascript function:
Code: [Select]
function form_url(keywords) {

// on remplace les espaces

ok_key = keywords.replace(/ /, ",");

location.href="http://www.YOURDOMAIN.com/recherche-images,"+ok_key+",1.html";
return false;
}
Note that if you change the statics words in STEP 1, you have to change it in this function

STEP 7 : change your htaccess...
here is mine :
Code: [Select]
RewriteEngine on



# REWRITE DES PAGES DETAILS

RewriteRule ^/image-(.*),([0-9]+)\.html$ /details.php?image_id=$2 [L]


# CATEGORIES

RewriteRule ^/categorie-(.*),([0-9]+),([0-9]+)\.html$ /categories.php?cat_id=$2&page=$3 [L]
RewriteRule ^/categorie-(.*),([0-9]+)\.html$ /categories.php?cat_id=$2 [L]



# SEARCH

RewriteRule ^/recherche-images\.html$ /search.php  [L]
RewriteRule ^/recherche-images,(.*),([0-9]+)\.html$ /search.php?show_result=1&search_keywords=$1&page=$2  [L]
RewriteRule ^/recherche-images,(.*)\.html$ /search.php?show_result=1&search_keywords=$1  [L]

RewriteRule ^recherches-statistiques\.html$ /search_stats.php  [L]
RewriteRule ^recherches-statistiques,([0-9]+)\.html$ /search_stats.php?page=$1  [L]



RewriteRule ^/nouvelles-images,1\.html$ /search.php?search_new_images=1  [L]
RewriteRule ^/nouvelles-images,1,([0-9]+)\.html$ /search.php?search_new_images=1&page=$1  [L]


And that's all ! (its quite easy, don't be afraid...)
the main function is function url in sessions.php, its here you have to pay attention for the name of your rewriting
and in all other page, you just have to add the name of categorie, image, search or whatever when you call the function url()
If you understand, you can do it for lighbox.php, member.php, postcard.php etc....

Best regards !
cyril

ps : i hope you understand how i code this and i apologize for my bad english
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: waleed on December 06, 2005, 12:50:39 PM
after i installed this MOD i got

Forbidden
You don't have permission to access / on this server.



am using 1.7.1

any idea plz ?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Acidgod on December 06, 2005, 02:51:12 PM
seems that your not allowed to use mod rewrite...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: waleed on December 06, 2005, 06:48:20 PM
everything is ok now  :)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Zyga on December 16, 2005, 07:13:56 PM
Thx ! Works great :)

only 2 questions
1.with one version is better this from I page or from 13 (and why)
2 in this moment it works realy nice but what when i change server on new one without rewrite module and without acces to add (activate) this module - what should I change in code ?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on December 17, 2005, 12:20:14 AM
1.with one version is better this from I page or from 13 (and why)
it depence on what is that you need ;) if you need only "convert" .php files into .html then first page is better, cause its simplier. But if you decided to add image names to the url, then 13 page would be the answer.
 
2 in this moment it works realy nice but what when i change server on new one without rewrite module and without acces to add (activate) this module - what should I change in code ?
You always should have backups of your files. So, if you change to a server without mod_rewrite available, simply restore the sessions.php from the backup before you modifyed it, and everyting should be alright ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: TheOracle on December 25, 2005, 10:05:14 PM
From your sessions.php file,

change :

Quote

$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$row['session_user_id'];


to :

Code: [Select]

$user_profile_link = (!empty($url_show_profile)) ? str_replace("{user_id}", $row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$row['session_user_id'];


Merry Christmas.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on December 26, 2005, 10:18:47 PM
@  v@no

Quote
Lets do one step at a time: fix the javascript errors, then if the problem remains, we'll continue troubleshoot.

Dear v@no, now i think i have fixed all my errors on my URL. But my problem with the category jumpbox  still exists.
Please try yourself on several pages of my site. On some pages it works and on some it isn't!
I think this problem exists, since i installed this MOD. Also texaholic has this problem if i remember right.

So please do you have advice to fix this problem :?:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on December 27, 2005, 10:49:10 PM
Sorry, I am not able to understand this instruction in SEF url mod on page 13 by "lotus69" first : in sessions.php
find the url function and replace it by : what I should lookout to replace (maybe more correct: which code I should replace)

Thanks for this wonderful mod. 8)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on December 28, 2005, 01:39:02 AM
You need to find this block of code:
Code: [Select]
  function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }
And replace it with what they posted.

P.S.
Just in case you didnt know, see a gray icon next to the each reply headline? if you move your mouse cursor over it, right click and choose "copy url" ("copy shortcut" or "copy location" whatever is in your browser), then you can post that url when you are referring to a specific reply and make it easier for others to find it ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on December 29, 2005, 06:02:22 PM
Thanks V@no

I never notice it, thanks for hinting it out :D

I know that this http://www.4homepages.de/forum/index.php?topic=6729.msg53658#msg53658 mod is difficult but the results that can be archived is compelling me to try it.

I have successfully modified all the steps expect step 2 and step 4
hope someone could make these steps a bit more easy :(

In step 2 for $site_sess->url(ROOT_PATH."details.php?"  added this $image_name  in the highlited area,

but for $site_sess->url(ROOT_PATH."categories.php?"  what should be added and where?

and in step 4

I just replaced

$link_arg = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id);
with

$link_arg = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id,0,$cat_cache[$cat_id]['cat_name']);

well the results are that;
if i am clicking on a image from random image with file name 82 and image name lc, this is what i am getting http://mysite.com/image-lc,82.html

and categories are
http://mysite.com/categorie-,1.html

but nothing open in this urk, just a 404 error

 :cry:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on December 30, 2005, 01:21:05 AM
The third parameter they mean the third parameter of the function.
the parameters are separated by comma. like this:
$site_session->url(param1, param2, param3)
So if you find the needed line, check how many parameters already supplyed. if only one, then after first parameter add:
, 0, $image_name
In some cases the second paramater already supplyed (something like , "&") , then all you need to add is:
, $image_name
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: shaqman1 on January 02, 2006, 04:48:40 AM
this mod is interesting, but i was wondering if it could be taken a step furthur. with this mod a url like this: http://www.website.com/details.php?image_id=8 would turn into this http://www.website.com/img8.htm.

But I was wondering if I could turn this url: http://www.website.com/details.php?image_id=8 into http://www.website.com/Ferrari, assuming my image name is Ferrari. Is that possible, or is that just a dream I am dreaming of?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on January 02, 2006, 05:50:30 AM
scroll back a few pages, atlest start reading from the middle ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: shaqman1 on January 02, 2006, 06:19:09 AM
scroll back a few pages, atlest start reading from the middle ;)

oh ok lol.. so i can't do what I wanted to do.

well...i use 4images for one of my sites and its awesome, but for my other site (which is not an image based site, but a video based site) i don't really think its nessessary, however i wanted to be able to use the ratings feature. ratings is really the reason for me wanted to use 4images for a non image site.

Is their any way I would be able to rate my files (like a .wmv or a .rm file) without have to be in the 4images gallery. Like could I implement that ratings feature on a page like "http://www.site.com/Food.php" instead of from "http://www.site.com/details.php?image_id=7883".

Even if I could do that without 4images that could be great. Thanks for the help!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: kief24 on January 15, 2006, 12:08:11 PM
Djith and me ordered this mod, to put image name and category name in url.
After testing and debugging, we think it is ok now, and we are happy to share it with you.


This mod puts the names of the categories and the images in the url like this :
for image --->http://www.your-site.com/img-imagename-andnumber.htm
category --->http://www.your-site.com/cat-categoryname-andnumber.htm

you can see it working on http://www.edupics.com (1.7) and http://www.avatarcorner.com (1.7.1)
on these sites the "img" and "cat" in the url were changed to some keywords.
( see http://www.4homepages.de/forum/index.php?topic=6729.msg41243#msg41243 )


there is also the possibility to make url's with full path to image and categories : ( see //comment in mod )
for image --->http://www.your-site.com/img-full path to image.htm
category --->http://www.your-site.com/cat-full path of category.htm
This was not tested on our sites.


Don't forget to backup your files before editing !

files to be edited :
.htaccess
includes/sessions.php

Code: [Select]

=================================================
1. at the end of .htaccess, add following code :
=================================================
#Mod_bmollet : category name in URL
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}

#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^img([0-9]+).search.htm details.php?image_id=$1&%{QUERY_STRING}

=======================================================================

=========================================
2. add this code to include/sessions.php
=========================================
//Mod_bmollet
/**
 * Get the category url
 * @param int $cat_id The id of the category
 * @param string $cat_url The current status of the URL
 */
function get_category_url($cat_id,$cat_url = '')
{
global $site_db;
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['cat_name'] = strtr($row['cat_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$cat_url = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
 * Get the image url
 * @param int $image_id The id of the image
 */
function get_image_url($image_id)
{
global $site_db;
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['image_name'] = strtr($row['image_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
// if you want comlpete path to image in url, remove comment from following line
//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}
========================================================================

========================================================================
3. In include/sessions.php replace function url(...) by following code.
========================================================================
/* ORIGINAL CODE
function url($url, $amp = "&amp;") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];

if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}

if (!empty($l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}

$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
}
*/
function url($url, $amp = "&amp;") {
global $l, $user_info;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
$url = str_replace('&amp;', '&', $url);
if (!defined('IN_CP')) {
if (strstr($url, 'index.php')) {
$url = str_replace('index.php', '', $url);
}
elseif (strstr($url, 'search.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('search.php', 'search.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('search.php', 'search.htm', $url);
}
}
elseif (strstr($url, 'lightbox.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('lightbox.php', 'lightbox.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('lightbox.php', 'lightbox.htm', $url);
}
}
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];
$cat_url = get_category_url($matches[1]);
$url = str_replace('categories.php', 'cat'.$cat_url.'.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);
}
}
elseif (strstr($url, 'details.php?image_id=')) {
if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', 'img'.$matches1[1].'.'.$matches2[1].'.htm', $url);
$query = str_replace('image_id='.$matches1[1].'&', '', $query);
$query = str_replace('&image_id='.$matches1[1], '', $query);
$query = str_replace('image_id='.$matches1[1], '', $query);
$query = str_replace('mode='.$matches2[1].'&', '', $query);
$query = str_replace('&mode='.$matches2[1], '', $query);
$query = str_replace('mode='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', 'img'.get_image_url($matches[1]).'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
elseif (strstr($url, 'postcards.php?image_id=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
if ($this->mode == "get" && strstr($url, $this->session_id)) {
$url .= strpos($url, '?') !== false ? '&' : '?';
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= strpos($url, '?') ? '&' : '?';
$url .= "l=".$l;
}
$url = str_replace('&', $amp, $url);
$url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
return $url;
}
========================================================================


========================================================================
4. In include/sessions.php following functions are useful for URL's like
yoursite.com/maincategory/subcategory/imagename.htm

This is not necessairy if you want url's (like we used on our sites) like this :
for image --->http://www.your-site.com/img-imagename-andnumber.htm
category --->http://www.your-site.com/cat-categoryname-andnumber.htm
========================================================================
//Mod_bmollet
/**
 * Get the category id
 * @param array $path An array with the path of the category
 * @param int $parent_id The parent id of the first item in the $path
 */
function get_category_id($path,$parent_id = 0)
{
$cat_name = array_shift($path);
global $site_db;
$sql = "SELECT cat_id FROM ".CATEGORIES_TABLE." WHERE cat_parent_id = $parent_id AND cat_name = '".mysql_real_escape_string($cat_name)."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
if( count($path) != 0)
{
return get_category_id($path,$row['cat_id']);
}
else
{
return $row['cat_id'];
}
}
//Mod_bmollet
/**
 * Get the image id
 * @param array $path An array with the path of the image
 */
function get_image_id($path)
{
global $site_db;
$image_name = array_pop($path);
$cat_id = get_category_id($path);
$sql = "SELECT image_id FROM ".IMAGES_TABLE." WHERE image_name = '".mysql_real_escape_string($image_name)."' AND cat_id = $cat_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
return $row['image_id'];
}
========================================================================

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: djith on January 16, 2006, 09:14:50 PM
Can't believe that nobody noticed the mod here above!!  :D
Well... try it out guys !!

 
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on January 21, 2006, 11:10:29 PM
From SEO point of view, which is better? (http://www.4homepages.de/forum/index.php?topic=6729.msg57268#msg57268)

1) http://www.your-site.com/img-imagename-andnumber.htm

OR

2) http://www.your-site.com/maincategory/subcategory/imagename.htm

P.S (added the 4th step to make it look like 2nd variant, but nothing seems to have changed, it still appear like the first variant) :(


EDIT:

I just installed this mod http://www.4homepages.de/forum/index.php?topic=10625.msg53408#msg53408 Multi-Lightboxes v1.03 and everything seem to be working, expect for the lightbox link,

like after rewritng; it's output is http://www.site.com/lightbox.htm, but pressing this gives a 404 error, same ploblem in the code of Multi-Lightboxes v1.03
Code: [Select]
{if url_lightbox_manage}
<a href="{url_lightbox_manage}"><b>{lang_lightbox_manage}</b></a>
{endif url_lightbox_manage}
also the output is http://www.site.com/lightbox.htm?action=manage where as http://www.site.com/lightbox.php?action=manage sovles the problem,

how can i correct this
Thanks :)

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: kief24 on January 22, 2006, 09:02:08 AM
From SEO point of view, which is better? (http://www.4homepages.de/forum/index.php?topic=6729.msg57268#msg57268)

1) http://www.your-site.com/img-imagename-andnumber.htm

OR

2) http://www.your-site.com/maincategory/subcategory/imagename.htm

P.S (added the 4th step to make it look like 2nd variant, but nothing seems to have changed, it still appear like the first variant) :(


to see full path, you must not only add step 4, but also comment / uncomment some lines in step two. I don't know if you've done that too ? ( you can read it in the mod ). This mod was tested it and it worked.

As the seo's concerned, if you put full path, you have more keywords in the url, but it's les accurate.
Like if people look for sea, they can get a url like this http://yoursite.com/animals/sea/dolphin.htm
Now they will land on the dolphin page while they were better off on the sea-category page.
If you use only the exact category or image, you will have something like http://yoursite.com/cat-sea-112.htm, SEO's will show this page because sea is only in this url, and people will land on the sea-category-page.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on January 22, 2006, 03:49:32 PM
OMG :oops: i guess i have screwed 8O my sessions.php, eveything works, but only like the first variant, please can anyone see what is wrong in my file... (attached)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: kief24 on January 22, 2006, 08:29:39 PM
I think you want to replace "img" and "cat" in the url by keywords, right ?

this is for url's like this :
for image --->http://www.your-site.com/keywords_for_images-imagename-andnumber.htm
category --->http://www.your-site.com/keywords_for_categories-categoryname-andnumber.htm


1. it should work with .htaccess like this :
-----------------------------------------------------------------------------------------------------------------
#begin code

RewriteEngine On

#RewriteBase /

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

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

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

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

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


RewriteRule ^keywords for categories-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
RewriteRule ^keywords for images-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
RewriteRule ^img([0-9]+).search.htm details.php?image_id=$1&%{QUERY_STRING}


----------------------------------------------------------------------------------------------------------------
2. add this code to includes/sessions.php


Code: [Select]

//Mod_bmollet
/**
* Get the category url
* @param int $cat_id The id of the category
* @param string $cat_url The current status of the URL
*/
function get_category_url($cat_id,$cat_url = '')
{
global $site_db;
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['cat_name'] = strtr($row['cat_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$cat_url = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
* Get the image url
* @param int $image_id The id of the image
*/
function get_image_url($image_id)
{
global $site_db;
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['image_name'] = strtr($row['image_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
// if you want comlpete path to image in url, remove comment from following line
//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}


-------------------------------------------------------------------------------------------------------------------------------
3. in includes/sessions.php

find

Code: [Select]
function url($url, $amp = "&amp;") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];

if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}

if (!empty($l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}

$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
}

change to this :
( note where keywords for categories and images are inserted )



  function url($url, $amp = "&amp;") {
global $l, $user_info;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
$url = str_replace('&amp;', '&', $url);
if (!defined('IN_CP')) {
if (strstr($url, 'index.php')) {
$url = str_replace('index.php', '', $url);
}
elseif (strstr($url, 'search.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('search.php', 'search.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('search.php', 'search.htm', $url);
}
}
elseif (strstr($url, 'lightbox.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('lightbox.php', 'lightbox.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('lightbox.php', 'lightbox.htm', $url);
}
}
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];
$cat_url = get_category_url($matches[1]);
$url = str_replace('categories.php', ' keywords for categories '.$cat_url.'.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);
}
}
elseif (strstr($url, 'details.php?image_id=')) {
if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', 'img'.$matches1[1].'.'.$matches2[1].'.htm', $url);
$query = str_replace('image_id='.$matches1[1].'&', '', $query);
$query = str_replace('&image_id='.$matches1[1], '', $query);
$query = str_replace('image_id='.$matches1[1], '', $query);
$query = str_replace('mode='.$matches2[1].'&', '', $query);
$query = str_replace('&mode='.$matches2[1], '', $query);
$query = str_replace('mode='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', ' keywords for images '.get_image_url($matches[1]).'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
elseif (strstr($url, 'postcards.php?image_id=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
if ($this->mode == "get" && strstr($url, $this->session_id)) {
$url .= strpos($url, '?') !== false ? '&' : '?';
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= strpos($url, '?') ? '&' : '?';
$url .= "l=".$l;
}
$url = str_replace('&', $amp, $url);
$url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
return $url;
}

------------------------------------------------------------------------------------------------------------------------------------------------

i can't give assistance for point 4 because i haven't used it myself.
( step 4 is needed for url's with full path )
for image --->http://www.your-site.com/img-full path to image.htm
category --->http://www.your-site.com/cat-full path of category.htm

I hope this is somehow helpful to you :)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on January 22, 2006, 09:47:55 PM
Thanks kief24
This information was useful, though, it's not what i am exately looking for, i am trying to implent the 4th step (URL's like
yoursite.com/maincategory/subcategory/imagename.htm) cause a friend of mine who is a SEO expert says that this is better that than (http://www.your-site.com/img-imagename-andnumber.htm)

my sessions.php is messed up, after implementing the 4th step also , no change at all!! it is same like (http://www.your-site.com/img-imagename-andnumber.htm) and i know this works (tested a fresh install)


 :(
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: kief24 on January 23, 2006, 09:24:17 AM
maxpaul, do you know why the SEO expert says that url with full path is better ?
( and i'll try out the 4th step myself this week. If i have problems with it i can contact the guy who wrote the mod and solve them )
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on January 23, 2006, 03:12:57 PM
kief24, I just had a talk with him,

he says that when in url we have http://www.site.com/cat_name/subcat_name/imagename.html its more human friendly, bots like Google takes the url into consideration... like it takes the page title, the directory you are in (meaning its name) and the page name itself..... Cause these add to a lot of keywords..... (to make the results more precise)

At the same time long filenames like http://www.sute.com/catname_subcatnames_sub_sub_catnames_imagenames_number.html (yea, sometimes it can become real long in this variants... :? ) can trigger a spam alarm and Google and other has good penalty for keyword stuffing
so better and safe way is the directory like structure....looks more real, meaning full and seems to be safer  ;)

p.s it seems like www.cat.site.com/file_name.html and www.site.com/cat/file_name.html is considered entirly diffrent by Google the first url, it considers it as an different site than www.site.com/cat/file_name.html and thus your page rank can be less for you sub domains (I had made this mistake a lot of times ;) )

note: because of the ever increasing number of people trying to cheat bots, good bots are trying to develop technologies to view the page same was as an human would have done it. so it does make sense to have an human friendly url..
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: godboko on January 27, 2006, 10:12:03 PM
This mod is simple and works GREAT thanks!!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: djith on January 29, 2006, 11:58:37 AM
okay well, back to the original thing here....

short url's....

i applied the first mod in this thread and what happened ? when you visit a page for the first time you get a session id !!
when you visit the second time it disappeared !! what is happening? 

when google visit my site it read's all the session id's and will not take my site into their database ....
realy have to get rid of those session id's .... anyone an idea ?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on January 29, 2006, 12:29:26 PM
okay well, back to the original thing here....

short url's....

i applied the first mod in this thread and what happened ? when you visit a page for the first time you get a session id !!
when you visit the second time it disappeared !! what is happening?

when google visit my site it read's all the session id's and will not take my site into their database ....
realy have to get rid of those session id's .... anyone an idea ?

yea, i too noticed this problem, how to deal with this? :?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on January 29, 2006, 05:05:43 PM
Trust me, google has no problem with sessionid in the url.
the sessionid is being attached when no cookies are set, and since search engines normaly dont use cookies, they always get sessionid in the url.
So, there is a way to detect a bot and dont attach sessionid for it, but doing so will create new session on each request bot made, that is more server resources, because more files will be created in the server's sessions storage.

So, if you still want to try, install this mod first:
http://www.4homepages.de/forum/index.php?topic=8752.0
(atleast do the Step 3. and if you dont want the whole mod, then remove
Code: [Select]
    $site_sess->login($val, "12345"); line)

Then in sessions.php find:
Code: [Select]
    if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {replace it with:
Code: [Select]
    global $user_bot;
    if (!$user_bot && $this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {

[EDIT]
In 4images v1.7.6 the line you should find is:
    if ($this->mode == "get" && strpos($url, $this->session_id) === false) {

Replace it with:    global $user_bot;
    if (!$user_bot && $this->mode == "get" && strpos($url, $this->session_id) === false) {
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: djith on February 06, 2006, 08:55:36 AM
I did like you explained , but i see that first time visitors still get session id's .... google too ....

is there another way to get rid of them ?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on February 06, 2006, 02:27:05 PM
but i see that first time visitors still get session id's .... google too ....
and how do you see that?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: djith on February 06, 2006, 09:46:40 PM
i use statcounter on my website and i can see the visitors path through the website... everytime they havae session id's also google registered all the session id's .....

http://www.google.com/search?q=site:http://www.avatarcorner.com/&hl=nl&lr=&start=10&sa=N

and


6th February 2006   21:03:43   www.avatarcorner.com/
www.startkabel.nl/k/avatar/
6th February 2006   21:04:00   www.avatarcorner.com/avatars-cartoons-8.htm?sessionid=1bdab4159150156f88f70dcc81791efa
www.avatarcorner.com/
6th February 2006   21:04:07   www.avatarcorner.com/
www.startkabel.nl/k/avatar/

magnify this user dsl.dynamic8121421044.ttnet.net.tr (Adsl-alc-gayrettepe-dynamic Pool)

Turkey, 0 returning visits
Date    Time    WebPage
6th February 2006   21:02:42   www.avatarcorner.com/
www.forumta.com/showthread.php?t=74808

magnify this user d51A4F3E5.access.telenet.be (Telenet Operaties N.v)

West-vlaanderen, Brugge, Belgium, 0 returning visits
Date    Time    WebPage
6th February 2006   20:51:04   www.avatarcorner.com/
avatar.startkabel.nl/k/avatar/index.php?nr=1
6th February 2006   20:51:14   www.avatarcorner.com/avatars-fun-1.htm?sessionid=4a320dc8d47777b473d35842cc6c2407
www.avatarcorner.com/
6th February 2006   20:52:20   www.avatarcorner.com/avatar-streetdance-2083.htm
www.avatarcorner.com/avatars-fun-1.htm?sessionid=4a320dc8d47777b473d35842cc6c2407

magnify this user 5352028A.cable.casema.nl (N.v. Casema)

Utrecht, Utrecht, Netherlands, 0 returning visits
Date    Time    WebPage
6th February 2006   20:31:43   www.avatarcorner.com/
avatars.2link.be/
6th February 2006   20:33:17   www.avatarcorner.com/avatars-movies-16.htm?sessionid=63c51dede4cd82a6190ff39629d17db8
www.avatarcorner.com/
6th February 2006   20:41:44   www.avatarcorner.com/
avatars.2link.be/
6th February 2006   20:42:12   www.avatarcorner.com/avatars-fun-1.htm
www.avatarcorner.com/
6th February 2006   20:44:32   www.avatarcorner.com/
avatars.2link.be/
6th February 2006   20:47:27   www.avatarcorner.com/avatars-symbols-27.htm
www.avatarcorner.com/
6th February 2006   20:50:18   www.avatarcorner.com/avatars-symbols-27.htm?page=2
www.avatarcorner.com/avatars-symbols-27.htm

magnify this user 82-169-179-30.dsl.ip.12move.nl (Wol)

Netherlands, 1 returning visit
Date    Time    WebPage
6th February 2006   20:46:32   www.avatarcorner.com/
avatar.startkabel.nl/k/avatar/index.php?nr=1
6th February 2006   20:46:38   www.avatarcorner.com/avatars-animals-10.htm?sessionid=d08154e1d854a41ef3c28a3e3bd9ebfb
www.avatarcorner.com/
6th February 2006   20:46:43   www.avatarcorner.com/avatars-forestanimals-30.htm
www.avatarcorner.com/avatars-animals-10.htm?sessionid=d08154e1d854a41ef3c28a3e3bd9ebfb
6th February 2006   20:46:51   www.avatarcorner.com/avatars-animals-10.htm?sessionid=d08154e1d854a41ef3c28a3e3bd9ebfb
www.avatarcorner.com/
6th February 2006   20:46:56   www.avatarcorner.com/avatars-spiders-94.htm
www.avatarcorner.com/avatars-animals-10.htm?sessionid=d08154e1d854a41ef3c28a3e3bd9ebfb
6th February 2006   20:47:25   www.avatarcorner.com/avatars-animals-10.htm?sessionid=d08154e1d854a41ef3c28a3e3bd9ebfb
www.avatarcorner.com/
6th February 2006   20:47:30   www.avatarcorner.com/avatars-dogs-95.htm
www.avatarcorner.com/avatars-animals-10.htm?sessionid=d08154e1d854a41ef3c28a3e3bd9ebfb
6th February 2006   20:47:40   www.avatarcorner.com/avatars-animals-10.htm?sessionid=d08154e1d854a41ef3c28a3e3bd9ebfb
www.avatarcorner.com/
6th February 2006   20:47:42   www.avatarcorner.com/
avatar.startkabel.nl/k/avatar/index.php?nr=1
6th February 2006   20:47:46   www.avatarcorner.com/avatars-arts-77.htm
www.avatarcorner.com/
6th February 2006   20:47:55   www.avatarcorner.com/avatar-dali-2678.htm
www.avatarcorner.com/avatars-arts-77.htm
6th February 2006   20:48:05   www.avatarcorner.com/avatars-arts-77.htm
www.avatarcorner.com/



Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: djith on February 19, 2006, 06:14:22 PM
anyone an idea ??
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on February 19, 2006, 06:21:09 PM
Well, lets see...how long have the bots visited your site before you've made these changes? do you think they will "forget" the addresses they collected in the past? - no they wont. They will continue re-visiting these adresses, which includes sessionid, for very long time, nothing you can do about it. They even might show these URLs for the people in search result - again, nothing you can do about it.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: djith on February 19, 2006, 09:16:21 PM
hmm.... the new url's are in use for one month now.....

hope that google will not forget me ! :)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on February 19, 2006, 09:23:06 PM
here is an intresting share: http://www.vaughns-1-pagers.com/internet/google-ranking-factors.htm

please note then point 53 "Dynamic Pages" = "Problematic - know pitfalls - shorten URLs, reduce variables, lose the session IDs"

 :D
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: BartAfterDark on February 20, 2006, 01:40:24 AM
I got a small problem with kief24's mod. Some of my categories has / in them. And thet messes the url. Is there a way so they will show up as - instead?

EDIT
I found out myself.
Changed:
Code: [Select]
$row['cat_name'] = strtr($row['cat_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");To:
Code: [Select]
$row['cat_name'] = strtr($row['cat_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ/","eeeaeauoiaabcdefghijklmnopqrstuvwxyz-"); :D
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: commandos on March 21, 2006, 04:38:36 AM
could someone tell me how to change the search links

like i have them  : domain/search.htm?search_keywords=reward

is there a way to integrate it in link ? domain/search-reward.htm ?

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on March 21, 2006, 06:06:37 AM
could someone tell me how to change the search links

like i have them : domain/search.htm?search_keywords=reward

is there a way to integrate it in link ? domain/search-reward.htm ?



Me too interested :D
is it possible to integrate it to v@no's sitemap MOD with the category and subcategory names linking to search using the above idea in quote :?:

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: ka on March 21, 2006, 08:40:12 PM
what is the actual version of this mod.. everybody has fixed something..

any new release for the mod?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Fastian on March 23, 2006, 12:28:16 AM
Two questions.
1)
Before I was using Version 1 of this mod. (Page 1). Today I read all the post starting from first page to end and decided to go for version 2. (Page 14)

Now What I would like to know is, considering the fact that having category name & image name in URL is very good. How much does it cost @ server end. I mean how much resources it takes only for converting URLs.

2) V@no wrote here
http://www.4homepages.de/forum/index.php?topic=6729.msg53397#msg53397

that to convert custom template files, this line should be added
Code: [Select]
RewriteRule ^([a-zA-Z0-9_\-]+)\.html$ index.php?template=$1&%{QUERY_STRING}
Now I have a template FAQ.html but I can't get it to work by faq.htm or by FAQ.htm

So what I want to ask is, to use this mod with custom template files, I just need to add the above line or is there is some other change as well???
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on March 23, 2006, 12:44:11 AM
1) as more REGEX in .htaccess and as more complex they as more server resources needed.

2) perhaps try remove letter "l":
[qcode]RewriteRule ^([a-zA-Z0-9_\-]+)\.html$ index.php?template=$1&%{QUERY_STRING}[/qcode]
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Fastian on March 23, 2006, 01:12:32 AM
1) as more REGEX in .htaccess and as more complex they as more server resources needed.

But it's not something that would be using too many resources. That could cause any issue with my hosting company.
M I Right???
Considering the current response of the site, I can say that my server is really fast one. At least I never got any such issue.

And about custom templates. It works now  :D

Thanks V@no 4 helping me one more time  :)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on March 23, 2006, 01:24:13 AM
I dont know how much is too much, but my .htaccess in root directory is about 22kb and has about 200+ lines in it and I didnt notice anything different perfomance wise...the site itself slow, but that another story :)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: commandos on March 23, 2006, 04:23:39 PM
hello ,

how can i prevent google from taking the sessions id , google see my link like this :

Code: [Select]
/cat1.htm?sessionid=86c5166e15152e2d38926567f7222ca8
how can i remove it to show like this

Code: [Select]
/cat1.htm

plz someone answer
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on March 24, 2006, 12:49:50 AM
please read the comments, we've discused this already.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Fastian on March 24, 2006, 07:05:16 AM
Hi V@no

You suggested a way to remove session IDs for search bots. Right here
http://www.4homepages.de/forum/index.php?topic=6729.msg59251#msg59251

I am using kief24   version of this mod (page 14)
http://www.4homepages.de/forum/index.php?topic=6729.msg57268#msg57268

In his modification, he has commented out this line.
Code: [Select]
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {

So what should I do to apply the changes u suggested for Bots??
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: commandos on March 24, 2006, 01:35:44 PM
Hi V@no
Quote
You suggested a way to remove session IDs for search bots. Right here
http://www.4homepages.de/forum/index.php?topic=6729.msg59251#msg59251


i allready tried this but it dont work ...

i just checked google cache and saw what it see .... sessions are evrywhere ...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on March 24, 2006, 01:48:20 PM
hmmmm :?

I too was interested to find a way to remove session IDs completely... like the very first time homepage loads, all links have this session IDs and if u click on any links, the second time page loads, we get clean links without session IDs, this ok ;) but the worse thing is all pages that get indexed by search engines have this session IDs :?

 :idea: v@no's previous idea on how to remove it is promising...
 :!: he has also mentioned the disadvantages of it, which is discouraging to apply it...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on March 24, 2006, 02:10:54 PM
i allready tried this but it dont work ...

i just checked google cache and saw what it see .... sessions are evrywhere ...
google cache? google store cache pages almost forever. you still can find cached pages of this site dated more then a year ago, even before the hack!
what did you expect?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on March 24, 2006, 02:24:45 PM
Hi V@no
Quote
You suggested a way to remove session IDs for search bots. Right here
http://www.4homepages.de/forum/index.php?topic=6729.msg59251#msg59251


i allready tried this but it dont work ...

i just checked google cache and saw what it see .... sessions are evrywhere ...


The best way to know;  what you have applied is working or not; is to load the page in your browser and hover over the category links and see if there is any session ID attached.

Checked in google cache will not help like v@no said.
and for that matter checking your site in search will not help momentarily, cause even if you site/page is re-indexed today. It takes days to get reflected in search results..

so if you do not find any session id attached, then you are doing it correct wait for few weeks or months to see the results without the session ID in search listings

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Fastian on March 24, 2006, 04:04:53 PM
:idea: v@no's previous idea on how to remove it is promising...
 :!: he has also mentioned the disadvantages of it, which is discouraging to apply it...

Thats why I am also interested in it. And about the disadvantage, I have worked it out. I mean Let the bot once crawle your site without session ID :wink:

Hi V@no

I am using kief24 version of this mod (page 14)
http://www.4homepages.de/forum/index.php?topic=6729.msg57268#msg57268

In his modification, he has commented out this line.
Code: [Select]
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {

So what should I do to apply the changes u suggested for Bots??

What to change in this version to use this mod?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: commandos on March 24, 2006, 08:11:57 PM
Quote
google cache? google store cache pages almost forever. you still can find cached pages of this site dated more then a year ago, even before the hack!
what did you expect?


google give you the date of the cache ... when it was taken so you can know what it see ....


Quote
This is G o o g l e's cache of http://www. as retrieved on 19 Mar 2006 05:14:50 GMT

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: commandos on March 29, 2006, 05:37:17 AM
gr8 help !!!!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on March 29, 2006, 10:42:27 AM
gr8 help !!!!

@ commandos

Pl dont get dishearten, this MOD is one of the most popular MOD here and there are virtually thousands of people trying to find the best configuration. I am also desperately looking for this information you are looking for! All I can tell is; let us wait and see, surely some one will come up with some idea ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on March 29, 2006, 03:05:08 PM
let us wait and see, surely some one will come up with some idea ;)
I have another idea: lets try and one more try. The code I've showed worked on my test server and others reported it worked. So, the solution is - try try try ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: tirakle on April 02, 2006, 11:58:12 AM
Is this mod also for the new version 1.7.2 ?

I tried to change the codes but they are different ( includes/sessions.php ) and it is not working.

Has anybody tried it successfully ?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: himu on April 03, 2006, 08:01:22 AM
Hey v@no can you help me :oops:
I was trying this without sucess:

Replace /member.php?action=uploadform with /upload
and Replace member.php?action=uploadform&cat_id=cat_id with /uploadcat_id[/b]

Example: /upload31 (where 31 is the cat id) -- like your site  :wink:

this is what i have done so far:
in .htaccess file (added):
Code: [Select]
RewriteRule ^upload$ member.php?action=uploadform%{QUERY_STRING}
RewriteRule ^upload\.([0-9]+)$ member.php?action=uploadform&cat_id=$1&%{QUERY_STRING}

in sessions.php file (added):
Code: [Select]
elseif (strstr($url, 'member.php?action=uploadform')) {
if (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('member.php?action=uploadform', 'upload'.$matches[1], $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('member.php?action=uploadform', 'upload', $url);
}
}

What did i do wrong ? :?: :roll:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: zoomos on April 03, 2006, 03:04:37 PM
How would I change

{prev_image_url} and {next_image_url}  so it will work with mod_rewrite

and {paging}

Help v@no, you like a god in this forum lol
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 04, 2006, 12:50:55 AM
@himu:
Try this:
Code: [Select]
elseif (strstr($url, 'member.php?action=uploadform'))
      {
        preg_match('#cat_id=([0-9]+)&?#', $url, $matches);
        $url_cat_id = "";
        if (isset($matches[1]))
        {
          $url_cat_id = $matches[1];
        }
        $split = explode('?', $url);
        $url = $split[0];
        $query = @$split[1];
        $url   = str_replace('member.php', 'upload'.$url_cat_id, $url);
        $query = str_replace('cat_id='.$url_cat_id.'&', '', $query);
        $query = str_replace('&cat_id='.$url_cat_id, '', $query);
        $query = str_replace('cat_id='.$url_cat_id, '', $query);
        $query = str_replace('action=uploadform&', '', $query);
        $query = str_replace('&action=uploadform', '', $query);
        $query = str_replace('action=uploadform', '', $query);
        if (!empty($query)) {
            $url .= '?' . $query;
        }
      }

and in .htaccess you can use only one line:
Code: [Select]
RewriteRule ^upload([0-9]*)$ member.php?action=uploadform&cat_id=$1&%{QUERY_STRING}

@zoomos:
I dont understand what do you mean...
If you added the code for image details page, it will affect next/prev links as well.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: himu on April 05, 2006, 07:30:49 AM
V@no,
 :( Unfortunately this did and did not work also... let me explain...

when i click on upload under any category it shows /member.php?action=uploadform&cat_id=10
but when i manually type upload10 it works... why?? :roll:

the hyperlinks are not changing ... why is that? any clues... :?:

@himu:
Try this ------- snip snip .....
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 05, 2006, 08:19:40 AM
perhaps you added this code below the member.php part that was already exists? can you show your url() function?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: himu on April 05, 2006, 08:25:08 AM
perhaps you added this code below the member.php part that was already exists? can you show your url() function?

Here is my function url():
Code: [Select]
  function url($url, $amp = "&amp;") {
    global $l, $user_info;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];
    $url = str_replace('&amp;', '&', $url);
    if (!defined('IN_CP')) {
      if (strstr($url, 'index.php')) {
        $url = str_replace('index.php', './', $url);
      }
      elseif (strstr($url, 'search.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('search.php', 'search'.$matches[1], $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('search.php', 'search', $url);
        }
      }
      elseif (strstr($url, 'lightbox.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('lightbox.php', 'album'.$matches[1], $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
                $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('lightbox.php', 'album', $url);
        }
      }

// myMOD upload string
      elseif (strstr($url, 'member.php?action=uploadform'))
      {
        preg_match('#cat_id=([0-9]+)&?#', $url, $matches);
        $url_cat_id = "";
        if (isset($matches[1]))
        {
          $url_cat_id = $matches[1];
        }
        $split = explode('?', $url);
        $url = $split[0];
        $query = @$split[1];
        $url   = str_replace('member.php?action=uploadform', 'upload'.$url_cat_id, $url);
        $query = str_replace('cat_id='.$url_cat_id.'&', '', $query);
        $query = str_replace('&cat_id='.$url_cat_id, '', $query);
        $query = str_replace('cat_id='.$url_cat_id, '', $query);
        if (!empty($query)) {
            $url .= '?' . $query;
        }
      }
// myMOD upload string END

      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', 'c'.$matches1[1].'.'.$matches2[1], $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', 'c'.$matches[1], $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', 'c', $url);
        }
      }
      elseif (strstr($url, 'details.php?image_id=')) {
        if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
          preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
          if (isset($matches1[1]) && isset($matches2[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php', $matches1[1].'.'.$matches2[1], $url);
            $query = str_replace('image_id='.$matches1[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches1[1], '', $query);
            $query = str_replace('image_id='.$matches1[1], '', $query);
            $query = str_replace('mode='.$matches2[1].'&', '', $query);
            $query = str_replace('&mode='.$matches2[1], '', $query);
            $query = str_replace('mode='.$matches2[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php', $matches[1], $url);
            $query = str_replace('image_id='.$matches[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches[1], '', $query);
            $query = str_replace('image_id='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
      }
      elseif (strstr($url, 'postcards.php?image_id=')) {
        preg_match('#image_id=([0-9]+)&?#', $url, $matches);
        if (isset($matches[1])) {
          $split = explode('?', $url);
          $url = $split[0];
          $query = @$split[1];
          $url   = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
          $query = str_replace('image_id='.$matches[1].'&', '', $query);
          $query = str_replace('&image_id='.$matches[1], '', $query);
          $query = str_replace('image_id='.$matches[1], '', $query);
          if (!empty($query)) {
            $url .= '?' . $query;
          }
        }
      }
    }
    if ($this->mode == "get" && strstr($url, $this->session_id)) {
      $url .= strpos($url, '?') !== false ? '&' : '?';
      $url .= SESSION_NAME."=".$this->session_id;
    }
    if (!empty($l)) {
      $url .= strpos($url, '?') ? '&' : '?';
      $url .= "l=".$l;
    }
    $url = str_replace('&', $amp, $url);
    $url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
    return $url;
  }
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 05, 2006, 08:49:47 AM
I've updated my previous post ;) should work now
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: himu on April 05, 2006, 09:43:26 AM
Great!!!! working fine... Thanks a lot... v@no
 8)
I've updated my previous post ;) should work now
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on April 07, 2006, 04:36:37 PM
Hey people,

I've noticed a lot of you have asked a way to completely remove sessionid's, as google DOES NOT like it.

Just add this somewhere in your .htaccess:

Code: [Select]
php_value session.use_cookies 1
php_value session.use_only_cookies 1
php_value session.use_trans_sid 0

Just add it at the very end of your .htaccess (for instance), and session id's are gone for good :D
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on April 07, 2006, 04:42:50 PM
Hey people,

I've noticed a lot of you have asked a way to completely remove sessionid's, as google DOES NOT like it.

Just add this somewhere in your .htaccess:

Code: [Select]
php_value session.use_cookies 1
php_value session.use_only_cookies 1
php_value session.use_trans_sid 0

Just add it at the very end of your .htaccess (for instance), and session id's are gone for good :D

getting internal server error 500 :(
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on April 07, 2006, 04:48:33 PM
Djith and me ordered this mod, to put image name and category name in url.
After testing and debugging, we think it is ok now, and we are happy to share it with you.


This mod puts the names of the categories and the images in the url like this :
for image --->http://www.your-site.com/img-imagename-andnumber.htm
category --->http://www.your-site.com/cat-categoryname-andnumber.htm

you can see it working on http://www.edupics.com (1.7) and http://www.avatarcorner.com (1.7.1)
on these sites the "img" and "cat" in the url were changed to some keywords.
( see http://www.4homepages.de/forum/index.php?topic=6729.msg41243#msg41243 )


there is also the possibility to make url's with full path to image and categories : ( see //comment in mod )
for image --->http://www.your-site.com/img-full path to image.htm
category --->http://www.your-site.com/cat-full path of category.htm
This was not tested on our sites.


Don't forget to backup your files before editing !

files to be edited :
.htaccess
includes/sessions.php

Code: [Select]
 
=================================================
1. at the end of .htaccess, add following code :
=================================================
#Mod_bmollet : category name in URL
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}

#Mod_bmollet : This is to make search function work  ( redirect links from search results )
RewriteRule ^img([0-9]+).search.htm details.php?image_id=$1&%{QUERY_STRING}

=======================================================================

=========================================
2. add this code to include/sessions.php
=========================================
//Mod_bmollet
/**
 * Get the category url
 * @param int $cat_id The id of the category
 * @param string $cat_url The current status of the URL
 */
function get_category_url($cat_id,$cat_url = '')
{
global $site_db;
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['cat_name'] = strtr($row['cat_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$cat_url  = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
 * Get the image url
 * @param int $image_id The id of the image
 */
function get_image_url($image_id)
{
global $site_db;
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['image_name'] = strtr($row['image_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
// if you want comlpete path to image in url, remove comment from following line
//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}
========================================================================

========================================================================
3. In include/sessions.php replace function url(...) by following code.
========================================================================
/* ORIGINAL CODE
  function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }
*/
  function url($url, $amp = "&amp;") {
    global $l, $user_info;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];
    $url = str_replace('&amp;', '&', $url);
    if (!defined('IN_CP')) {
      if (strstr($url, 'index.php')) {
        $url = str_replace('index.php', '', $url);
      }
      elseif (strstr($url, 'search.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('search.php', 'search.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('search.php', 'search.htm', $url);
        }
      }
      elseif (strstr($url, 'lightbox.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('lightbox.php', 'lightbox.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
                $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('lightbox.php', 'lightbox.htm', $url);
        }
      }
      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];
            $cat_url = get_category_url($matches[1]);
            $url   = str_replace('categories.php', 'cat'.$cat_url.'.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);
        }
      }
      elseif (strstr($url, 'details.php?image_id=')) {
        if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
          preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
          if (isset($matches1[1]) && isset($matches2[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php', 'img'.$matches1[1].'.'.$matches2[1].'.htm', $url);
            $query = str_replace('image_id='.$matches1[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches1[1], '', $query);
            $query = str_replace('image_id='.$matches1[1], '', $query);
            $query = str_replace('mode='.$matches2[1].'&', '', $query);
            $query = str_replace('&mode='.$matches2[1], '', $query);
            $query = str_replace('mode='.$matches2[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php', 'img'.get_image_url($matches[1]).'.htm', $url);
            $query = str_replace('image_id='.$matches[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches[1], '', $query);
            $query = str_replace('image_id='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
      }
      elseif (strstr($url, 'postcards.php?image_id=')) {
        preg_match('#image_id=([0-9]+)&?#', $url, $matches);
        if (isset($matches[1])) {
          $split = explode('?', $url);
          $url = $split[0];
          $query = @$split[1];
          $url   = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
          $query = str_replace('image_id='.$matches[1].'&', '', $query);
          $query = str_replace('&image_id='.$matches[1], '', $query);
          $query = str_replace('image_id='.$matches[1], '', $query);
          if (!empty($query)) {
            $url .= '?' . $query;
          }
        }
      }
    }
    if ($this->mode == "get" && strstr($url, $this->session_id)) {
      $url .= strpos($url, '?') !== false ? '&' : '?';
      $url .= SESSION_NAME."=".$this->session_id;
    }
    if (!empty($l)) {
      $url .= strpos($url, '?') ? '&' : '?';
      $url .= "l=".$l;
    }
    $url = str_replace('&', $amp, $url);
    $url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
    return $url;
  }
========================================================================


========================================================================
4. In include/sessions.php following functions are useful for URL's like
   yoursite.com/maincategory/subcategory/imagename.htm
   
   This is not necessairy if you want url's (like we used on our sites) like this :
   for image --->http://www.your-site.com/img-imagename-andnumber.htm
   category --->http://www.your-site.com/cat-categoryname-andnumber.htm
========================================================================
//Mod_bmollet
/**
 * Get the category id
 * @param array $path An array with the path of the category
 * @param int $parent_id The parent id of the first item in the $path
 */
function get_category_id($path,$parent_id = 0)
{
$cat_name = array_shift($path);
global $site_db;
$sql = "SELECT cat_id FROM ".CATEGORIES_TABLE." WHERE cat_parent_id = $parent_id AND cat_name = '".mysql_real_escape_string($cat_name)."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
if( count($path) != 0)
{
return get_category_id($path,$row['cat_id']);
}
else
{
return $row['cat_id'];
}
}
//Mod_bmollet
/**
 * Get the image id
 * @param array $path An array with the path of the image
 */
function get_image_id($path)
{
global $site_db;
$image_name = array_pop($path);
$cat_id = get_category_id($path);
$sql = "SELECT image_id FROM ".IMAGES_TABLE." WHERE image_name = '".mysql_real_escape_string($image_name)."' AND cat_id = $cat_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
return $row['image_id'];
}
========================================================================

Cool MOD, but frankly it doesn't make sense.
What exactly are we supposed to do in order to get URLs like:

http://www.site.com/category/imagename.html ?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on April 07, 2006, 04:49:56 PM
Hey people,

I've noticed a lot of you have asked a way to completely remove sessionid's, as google DOES NOT like it.

Just add this somewhere in your .htaccess:

Code: [Select]
php_value session.use_cookies 1
php_value session.use_only_cookies 1
php_value session.use_trans_sid 0

Just add it at the very end of your .htaccess (for instance), and session id's are gone for good :D

getting internal server error 500  :(
Can you show your htaccess file here (or PM it to me if you don't want it out in public)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: djith on April 07, 2006, 10:51:57 PM
i found out that google read my entire website two times recently..... thought that it will be okay now ---session id's in cache----- but no sir-----still session id's------ i can see in cache of google that it read my site few days ago......


realy...... my friend mike has no session id's anymore in google...... vanished...... he has version 1.7
i think to downgrade my site to 1.7 ---seems to work whit 1.7
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: tirakle on April 10, 2006, 06:22:23 PM
Hi there,

I installed this mod and it is working almost perfectly. But I have 2 problems.

If I enter my site for the first time the url is changed e.g. into:

http://www.amazing-gifs.de/gifs/cat142.htm?sessionid=a83f0fa42dfde9479d7bd56e8a4789ee

if I enter the site for the secornd time the urls name ist only:

http://www.amazing-gifs.de/gifs/cat142.htm


So thats how I want it to be ( http://www.amazing-gifs.de/gifs/cat142.htm ) .

Why is the sessionid shown if I enter for the first time ?
What do I have to change so that all the URL looks like the second ??  ( Im using version 1.7.2 )

After changing the files my the Control Center is not working right. Does anybody have this problem too ?

Can anybody plaease help ?

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: djith on April 10, 2006, 10:17:03 PM
i'm using 1.7.1 and has the same problem, i'm looking for a solution wich my previous post on this topic could be a solution i think.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 11, 2006, 02:48:14 AM
Hi there,

I installed this mod and it is working almost perfectly. But I have 2 problems.

If I enter my site for the first time the url is changed e.g. into:

http://www.amazing-gifs.de/gifs/cat142.htm?sessionid=a83f0fa42dfde9479d7bd56e8a4789ee

if I enter the site for the secornd time the urlґs name ist only:

http://www.amazing-gifs.de/gifs/cat142.htm


So thatґs how I want it to be ( http://www.amazing-gifs.de/gifs/cat142.htm ) .

Why is the sessionid shown if I enter for the first time ?
What do I have to change so that all the URL looks like the second ?? ( Iґm using version 1.7.2 )

After changing the files my the Control Center is not working right. Does anybody have this problem too ?

Can anybody plaease help ?


sessionid is required for 4images, it only appiers when no cookies were set (first visit) or when they are disabled. If you want to disable sessionid in the url, you will only slow down your gallery and privent visitors with blocked cookies use your site with full features. please read the reply, we've discuss it here already.

@djith:
you did something wrong, I just followed my own instructions and it worked just fine on v1.7, 1.7.1 and v1.7.2 (the latter had different line to search for, though)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: tirakle on April 11, 2006, 06:56:17 PM
@ V@no

yes I know about the sessions. But I was just wondering why the session is shown in the url for one time. If I visit another site that uses 4images the session id does not appear.

since I changed the sessions.php file my control center does not work right. I can see only:

Warning: Cannot modify header information - headers already sent by (output started at /home/www/kunden/amazing-gifs.de/gifs/includes/sessions.php:604) in /home/www/kunden/amazing-gifs.de/gifs/admin/admin_functions.php on line 168

Warning: Cannot modify header information - headers already sent by (output started at /home/www/kunden/amazing-gifs.de/gifs/includes/sessions.php:604) in /home/www/kunden/amazing-gifs.de/gifs/admin/admin_functions.php on line 169

Warning: Cannot modify header information - headers already sent by (output started at /home/www/kunden/amazing-gifs.de/gifs/includes/sessions.php:604) in /home/www/kunden/amazing-gifs.de/gifs/admin/admin_functions.php on line 170

Warning: Cannot modify header information - headers already sent by (output started at /home/www/kunden/amazing-gifs.de/gifs/includes/sessions.php:604) in /home/www/kunden/amazing-gifs.de/gifs/admin/admin_functions.php on line 171

Warning: Cannot modify header information - headers already sent by (output started at /home/www/kunden/amazing-gifs.de/gifs/includes/sessions.php:604) in /home/www/kunden/amazing-gifs.de/gifs/admin/admin_functions.php on line 172


Do you know what went wrong or can anybody help ??
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 12, 2006, 01:59:55 AM
yes, and its covered in the FAQ, most probably you left a space or a newline after ?>

P.S. what other site did you visit that did not show sessionid? unless that site used the sessionid removal code, its not possible UNLESS, you've visited it once before and the sessionid was left in your cookies.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: commandos on April 13, 2006, 07:18:47 AM
Hey people,

I've noticed a lot of you have asked a way to completely remove sessionid's, as google DOES NOT like it.

Just add this somewhere in your .htaccess:

Code: [Select]
php_value session.use_cookies 1
php_value session.use_only_cookies 1
php_value session.use_trans_sid 0

Just add it at the very end of your .htaccess (for instance), and session id's are gone for good :D

Any disavantage of this version ? because it work for me
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: commandos on April 13, 2006, 01:17:16 PM
it was working yesterday no more sessionsid's ..... woke up today to see that it was giving 502 error ...  :x
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: ascanio on April 17, 2006, 04:45:23 AM
I love this mod!!! google loves it too :):)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: koikonut on April 18, 2006, 09:53:02 PM
Thank you for the mod! But I have an error!!
 All the mod-rewrite-functions work, but I receive the following warnings - but not like "tirakle" on Admin-Pages, but on every page of my gallery http://www.konradin.net/galerie .

Warning: session_start(): open(/tmp/sess_42628b585b5e31a47cc61dee0fe7abbe, O_RDWR) failed: Permission denied (13) in /www/htdocs/v110298/galerie/includes/sessions.php on line 102

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /www/htdocs/v110298/galerie/includes/sessions.php:102) in /www/htdocs/v110298/galerie/includes/sessions.php on line 102

Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/v110298/galerie/includes/sessions.php:102) in /www/htdocs/v110298/galerie/includes/sessions.php on line 110

Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/v110298/galerie/includes/sessions.php:102) in /www/htdocs/v110298/galerie/includes/sessions.php on line 110

Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/v110298/galerie/includes/sessions.php:102) in /www/htdocs/v110298/galerie/includes/sessions.php on line 110


I did not left any spaces in my code - but I have the script version 1.7.2

What can I do? I forgot to make a backup of my sessions.php an made changes before yet :-( Shall I post my sessions.php - Code?

Thx for helping, Bye Konradin
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 19, 2006, 01:36:14 AM
this covered in the FAQ ;) (not related to this mod)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: koikonut on April 19, 2006, 02:53:38 AM
Is this MOD working with 1.7.2 ?? I ask because the text that I have to replace doesn't exist completely - only the beginning and the end...

Do I have to replace the following code?

Code: [Select]
  function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && strpos($url, $this->session_id) === false) {
      $url .= strpos($url, '?') !== false ? $amp : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= strpos($url, '?') !== false ? $amp : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }

THX for helping, bye Konradin
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 19, 2006, 03:38:16 AM
should work, and if you wish you can replace
Code: [Select]
    if ($this->mode == "get" && strstr($url, $this->session_id)) {
      $url .= strpos($url, '?') !== false ? '&' : '?';
      $url .= SESSION_NAME."=".$this->session_id;
    }
    if (!empty($l)) {
      $url .= strpos($url, '?') ? '&' : '?';
      $url .= "l=".$l;
    }
    $url = str_replace('&', $amp, $url);
with
Code: [Select]
    if ($this->mode == "get" && strpos($url, $this->session_id) === false) {
      $url .= strpos($url, '?') !== false ? $amp : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= strpos($url, '?') !== false ? $amp : "?";
      $url .= "l=".$l;
    }
but it should work with any additional changes...(I havent tested it though)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 19, 2006, 07:33:38 AM
i found out that google read my entire website two times recently..... thought that it will be okay now ---session id's in cache----- but no sir-----still session id's------ i can see in cache of google that it read my site few days ago......


realy...... my friend mike has no session id's anymore in google...... vanished...... he has version 1.7
i think to downgrade my site to 1.7 ---seems to work whit 1.7
google will show sessionid in the cache pages "forever", you cant do anything about it.
Yet, when it visit page from the old cached address with sessionid, all new links from that page will not contein sessionid BUT that page itself might get updated in google cache but still will contein sessionid, because google visited it from cached address and not from "fresh" page, see what I mean?

You can not tell by looking at date when the google cached a page if the code working or not. The only way to test it properly is either change your browsers agent identification to "google" or add your browser in the bots list and then block all the cookies and browse your site.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sopur on April 27, 2006, 02:12:51 PM
Sorry to ask that question, but for version 1.7 - witch version of this mod shoul i use?
Regards
Sopur
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on April 27, 2006, 02:31:47 PM
the original
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sopur on April 27, 2006, 02:55:27 PM
the original
That one from page 1?
Thanks!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: koikonut on May 03, 2006, 05:55:05 AM
Hello everyone!

Could someone make a conclusion of possible addons fpr the script/mod? There are so many small additions that I can't see clearly what I need to make the following changes (Perhaps still not discussed yet - I have read more than 15 pages):

1. member.php?action=show_user.... ----> member_profile_admin.html

2. Has anybody made a solution to modify the links of the "Mod Language Select (http://www.4homepages.de/forum/index.php?topic=4743.0)"? I'm using Version B.

3. Paging? - Categories (and perhaps comments?)? (cat5_2_de.html, cat5_2_en.html, cat6_5_es.html ...)

That would be really great!!!
Thx you so much for helping, bye Konradin

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on May 04, 2006, 10:49:04 AM
@ kief24 & Djith

 :?: is it possible to change

Quote
for image --->http://www.your-site.com/img-imagename-andnumber.htm
category --->http://www.your-site.com/cat-categoryname-andnumber.htm

to

Quote
for image --->http://www.your-site.com/imagename-img-andnumber.htm
category --->http://www.your-site.com/categoryname-cat-andnumber.htm

thanks :D

:!: has anyone got the 4th step of this mod: http://www.4homepages.de/forum/index.php?topic=6729.msg57268#msg57268 working?

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on May 08, 2006, 03:54:17 PM
Friends I have found a shocking bug in the mod: http://www.4homepages.de/forum/index.php?topic=6729.msg57268#msg57268 8O

do not know how serious it as SEO is concerned but has bad user experience!!! :? :?

the problem: on sites using this: http://www.4homepages.de/forum/index.php?topic=6729.msg57268#msg57268 MOD

go to an image, note the current url and page title, press the download to download any image now go to home page or another image and u will be shocked to see that the browser url do not change anymore.. and so does not change the page title (but I seen changes for few seconds when u click the images) but again the old url is show in page title!!!

I guess we need to fix this problem ASAP!!! :(

I found this problem on V@nos site too.. meaning all of us using these mod will be having this problem 8O

p.s I found this problem in IE only. need to do more testing.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on May 09, 2006, 01:18:15 AM
go to an image, note the current url and page title, press the download to download any image now go to home page or another image and u will be shocked to see that the browser url do not change anymore.. and so does not change the page title (but I seen changes for few seconds when u click the images) but again the old url is show in page title!!!

I guess we need to fix this problem ASAP!!! :(

I found this problem on V@nos site too.. meaning all of us using these mod will be having this problem 8O

p.s I found this problem in IE only. need to do more testing.
Actualy its you who need fix your windows :P
There is no way anyone could possibly manipulate address in the address bar remotely (aka web sites), because it would be security risk and we all would be bombarded by phishing sites.

I dont use IE itself, but I've seen such issue in Maxthon, which is using IE engine, but I thought it was a bug in Maxthon, now possible its actualy IE bug...

P.S. just for the record, I dont use that mod ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on May 09, 2006, 11:09:32 AM
Thanks for the reply... i guess me and all my friends will need a win fix now :D :D :D

I meant to say u are using rewrite mod and not a particular mod..... :wink:

just interesting: anyone using IE 7 beta is getting such a problem?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: 2dartist.com on May 11, 2006, 01:50:04 PM
Can you please

- Add all the updatd info in the first post?
It is really difficult to read all of the pages and know what to do or not. I stopped at page 7. It really would help others if you could edit your first post with most complete/updated mod.

- Add catagories/filenames to the url?

I know you said this is not possible due due to same names of catagoroes/files. But Can't we have them in wordpress style. Where you can add the catagory id and file if part pf the url. So a link of something like this.

instead of http://www.yourdomain.com/catid23.htm

Can we have something like this.
http://www.yourdomain.com/catid23/family-art/
or may be

http://www.yourdomain.com/23/12/family-art/mykids.html
Where 23 is catagory id and 12 is file id to keep track of the ids.

Please let me know if this is possible because i will buy a commercial license but need to know  more details on it.

Thanks!
- chodhry

 

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on May 11, 2006, 02:26:48 PM
1) on first page is complete, working solution. the rest of the pages were about optional/unneccery additions
2) start reading from the end, there is a solution for image/categories names. Still, I dont understand why is that helpfull in any way, as long as you have your title fixed, the address bar is irrelevant.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: 2dartist.com on May 11, 2006, 04:27:49 PM
Well it helps from SEO point of view and that I am saying from my experience. Crawlers/bots of famous search engine put more emphaysis on frequently updated static pages because they take them as if a human being is working on them instead of a database. A url with keyword is just more helpful because it adds even more weight to have them beleive that there is some human factor involved in the creation of this page so it gets better page ranking.

(Just to help you understand this more, my webmaster forum has the word "trade" in the domain and the forum is also in a folder "trade". Now even if the content and keywords and title has nothing to do with the forex or futurus trade or stock market, google still show those type of ads all over. So at leaset google gives much importance to the url itself and think of my webmaster forum as if it is a forum for trading and stock market just due to the word trade in the url.)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: himu on May 13, 2006, 07:25:07 PM
now that my
http://poview.org/categories.php?cat_id=1
changed to
http://poview.org/c1

how can i change
http://poview.org/c1?page=2
to
http://poview.org/c1.2

like v@no  :wink:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lukasinoooo on May 14, 2006, 12:59:14 AM
Work good but when i login i have error


DB Error: Bad SQL Query: SELECT lightbox_id, lightbox_name, lightbox_image_ids, lightbox_private, id, lightbox_lastaction, IF(id = , id, 0) AS num FROM 4images_lightboxes WHERE user_id = 1 ORDER BY id ASC
Something is wrong in your syntax obok ' id, 0) AS num FROM 4images_lightboxes ' w linii 1

DB Error: Bad SQL Query: UPDATE 4images_users SET user_lightbox = 0 WHERE user_id = 1
Nieznana kolumna 'user_lightbox' w field list

Warning: Cannot modify header information - headers already sent by (output started at c:\usr\apache\httpd\html\3\includes\db_mysql.php:188) in c:\usr\apache\httpd\html\3\includes\sessions.php on line 92

Warning: Cannot modify header information - headers already sent by (output started at c:\usr\apache\httpd\html\3\includes\db_mysql.php:188) in c:\usr\apache\httpd\html\3\includes\sessions.php on line 92

Warning: Cannot modify header information - headers already sent by (output started at c:\usr\apache\httpd\html\3\includes\db_mysql.php:188) in c:\usr\apache\httpd\html\3\login.php on line 51
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on May 14, 2006, 02:09:36 AM
and this start happening after you installed this mod? - doubtfull...
check changes from this mod instead:
http://www.4homepages.de/forum/index.php?topic=10625.0
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: sigma. on May 15, 2006, 08:19:29 PM
when navifating through your site, Ive seen that you have even cooler URLs...

instead of
http://gallery.vano.org/en/11991.htm
you have
http://gallery.vano.org/en/11991

How is this done?
Also the language URL is done in cool style ...
Will the mod do that also like in your site?

Regards, and thanks.
Daniel

sorry, that method would require alot more changes in many .php files and require very complex .htaccess
but u could try remove .htm from sessions.php and adjust .htaccess

> V@no

Could you please let us in on your workaround for this? I dont need this for every link, just the menu items like Memberlist, Top Images, New Images, ect.. also i noticed on yoru site you have a Google Map setup, I have done the same but im restricted to how I can use it and I think if I had a link like this http://www.cydonian.com/photos/gmap insted of my current setup http://www.cydonian.com/photos/index.php?template=gmap then the google map would be a bit more interactive and user friendly.

This would really help the 4images engine I think. Not to mention my little dilemma. If you have any ideas that might help me toher than the top request please let me know.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Malcolm Feth on May 15, 2006, 08:34:33 PM
i have problem with IE browser

when i'm entering to one (only in this one category problem exists)
the browser looks like been reloading page a few times... and finally get error "could not open page"

what is the problem ?

ps,. if you want to try, enter:
http://www.honda-crx.info/galeria
and then find category: Wasze CRXy (2030)
subcategory: CRX 88-92 Druga Generacja

and of course open page with IE :)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on May 16, 2006, 01:00:43 AM
@sigma:
in sessions.php replace
Code: [Select]
if (strstr($url, 'index.php')) {
$url = str_replace('index.php', './', $url);
}
With:
Code: [Select]
if (strstr($url, 'index.php')) {
if (strstr($url, 'template=')) {
preg_match('#template=([0-9a-zA-Z_-]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('index.php', 'page-'.$matches[1].'.htm', $url);
$query = str_replace('template='.$matches[1].'&', '', $query);
$query = str_replace('&template='.$matches[1], '', $query);
$query = str_replace('template='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('index.php', './', $url);
}
}

And in .htaccess add:
Code: [Select]
RewriteRule ^page-(.+)\.htm$ index.php?template=$1&%{QUERY_STRING}

@Malcolm Feth:
nothing to do with this mod. It seems its the way IE renders your page...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: sigma. on May 16, 2006, 01:48:16 AM
Thanks for the response v@no. unfortunately that didnt seem to do anything.

Is there a way I can test it?

Tried
http://www.cydonian.com/photos/memberlist

Insted of
http://www.cydonian.com/photos/memberlist.php

but i get the good ol' 404 error.

maybe i have to place the .htaccess add somewhere specific in the file? top or bottom?

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on May 16, 2006, 02:18:04 AM
Ops, i forgot to mention, that to avoid any problems with real html files in your gallery root, I've added page- prefix to the filenames.
so in your case its page-gmap.htm
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: sigma. on May 16, 2006, 02:35:45 AM
ah interesting. ok so i change page- to view- but it looks like some .php files wont convert, thats fine. It was really only for the gmap iframe taht i have implemented. Thanks Vano. If i have anymore questions on this I will PM you, hope thats ok. Just dont want to add to an already massive thread. Plus other people with questions.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Malcolm Feth on May 16, 2006, 08:48:32 PM
i was trying to do something with my problem

when i moved a few subcategories, the problem with opening main category doesn't exists.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on May 16, 2006, 11:37:54 PM
Malcolm Feth sorry, but I dont understand what is the problem.
Please explain in details and step-by-step how to reproduce it or how to see it in action.

P.S. are you sure this has anything to do with this mod?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Malcolm Feth on May 17, 2006, 08:48:25 AM
www.honda-crx.info/galeria
find category named: Wasze CRXy (but do not enter in)
enter to subcategory: CRX 88-92 Druga Generacja

under IE - page reloads - all the time

and if i enter (thru admin panel) to "old style" adres (http://www.honda-crx.info/galeria/categories.php?cat_id=40)
page works great
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on May 17, 2006, 02:37:26 PM
Sorry, couldnt reproduce it, the page did not refresh for me... it opens instantly without any refresh...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Malcolm Feth on May 17, 2006, 03:02:50 PM
from main page of gallery i'm entering "88-92 druga generacja" subdirecroty of "Wasze CRXy"
and i have something like refreshing.. i have this thing on a few computers and only under Internet Explorer
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Eagle Eye on May 20, 2006, 01:30:31 PM
i am using this mod: http://www.4homepages.de/forum/index.php?topic=6729.msg57268#msg57268

I have changed the url this mod make from:
Quote
for image --->http://www.your-site.com/img-imagename-andnumber.htm
category --->http://www.your-site.com/cat-categoryname-andnumber.htm

to

Quote
for image --->http://www.your-site.com/imagename-andnumber-img.htm
category --->http://www.your-site.com/categoryname-andnumber-cat.htm

how can i change it to

Quote
for image --->http://www.your-site.com/imagename-img-andnumber.htm
category --->http://www.your-site.com/categoryname-cat-andnumber.htm

i tried a lot but always getting error.. any idea what i need to edit? :?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: himu on May 21, 2006, 08:20:02 PM
now that my
http://poview.org/categories.php?cat_id=1
changed to
http://poview.org/c1

how can i change
http://poview.org/c1?page=2
to
http://poview.org/c1.2

like v@no :wink:

Hello V@no... pls help
here's the category section of my sessions.php
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', 'c'.$matches1[1].'.'.$matches2[1], $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', 'c'.$matches[1], $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', 'c', $url);
}
}
and here's my .htaccess
Code: [Select]
RewriteRule ^c$ categories.php?%{QUERY_STRING}
RewriteRule ^c([0-9]+)\.([0-9]+)$ categories.php?cat_id=$1&page=$2&%{QUERY_STRING}
RewriteRule ^c([0-9]+)$ categories.php?cat_id=$1&%{QUERY_STRING}
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on May 21, 2006, 09:06:46 PM
What is the problem?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: himu on May 23, 2006, 02:52:43 PM
What is the problem?
Problem is when i move my mouse over the paging links
Quote
[1]  2  3  4  5  6  7  8  9  10  11  12  13  14  15  ...  Next page   Last page

It shows:
http://poview.org/c1?page=2

not
http://poview.org/c1.2

but if i manually enter the address  http://poview.org/c1.2 it works.

was i able to clear my self?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marod0er on May 25, 2006, 05:25:41 PM
STEP 7 : change your htaccess...
here is mine :
Code: [Select]
RewriteEngine on



# REWRITE DES PAGES DETAILS

RewriteRule ^/image-(.*),([0-9]+)\.html$ /details.php?image_id=$2 [L]


# CATEGORIES

RewriteRule ^/categorie-(.*),([0-9]+),([0-9]+)\.html$ /categories.php?cat_id=$2&page=$3 [L]
RewriteRule ^/categorie-(.*),([0-9]+)\.html$ /categories.php?cat_id=$2 [L]



# SEARCH

RewriteRule ^/recherche-images\.html$ /search.php  [L]
RewriteRule ^/recherche-images,(.*),([0-9]+)\.html$ /search.php?show_result=1&search_keywords=$1&page=$2  [L]
RewriteRule ^/recherche-images,(.*)\.html$ /search.php?show_result=1&search_keywords=$1  [L]

RewriteRule ^recherches-statistiques\.html$ /search_stats.php  [L]
RewriteRule ^recherches-statistiques,([0-9]+)\.html$ /search_stats.php?page=$1  [L]



RewriteRule ^/nouvelles-images,1\.html$ /search.php?search_new_images=1  [L]
RewriteRule ^/nouvelles-images,1,([0-9]+)\.html$ /search.php?search_new_images=1&page=$1  [L]
I would like you to explain this a bit more. Is this really your htaccess file? Because it doesn't work for me. Could you please tell me what i'm doing wrong - I get a 404 error on whatever page i try to access. Thanks
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: arabse on May 29, 2006, 04:18:20 AM
Good The 1st page way , worked fine with 1.7.2

 :D Well Done
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: exefire on May 29, 2006, 11:12:16 PM
What is the problem?
Problem is when i move my mouse over the paging links
Quote
[1]  2  3  4  5  6  7  8  9  10  11  12  13  14  15  ...  Next page   Last page

It shows:
http://poview.org/c1?page=2

not
http://poview.org/c1.2

but if i manually enter the address  http://poview.org/c1.2 it works.

was i able to clear my self?

i have the same problema...  :cry: :cry: :cry:

v@no: do you have any idea for this  :?:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: sanitarium on June 12, 2006, 01:30:03 AM
My website's language is turkish. I installed this mode and work fine but I have a problem. Turkish chars to spoil in the url, exp; http://www.xxx.com/kategori-t%FCrk-amat%F6r-resimleri-13.htm. The link must be http://www.xxx.com/kategori-trk-amatr-resimleri-13.htm. How can I fix this problem? Help please...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on June 12, 2006, 05:32:34 AM
You can not use non-latin letters in the urls, period.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Beautiful Body Castings on June 15, 2006, 01:20:54 AM
i am having troubles with the mod rewrite functions

im using a server hosted at godaddy

i have seen info like the below posted on other sites but wsnt sure what it meant

Quote
"But GoDaddy didn't like that. Another solution is to use rewrite directives, like this:

RewriteEngine on
RewriteBase /
RewriteRule ^index\.html$ index.php

But that didn't work either. When I searched the Internet, a lot of people seemed convinced that GoDaddy wouldn't let you do mod-rewrite stuff at all. But after a bunch of trial-and-error, I hit upon this:

RewriteEngine on
RewriteBase /
RewriteRule (.*)index\.html$ $1index.php

Note the slight regular-expression change. This seems to work!"

i have read that mod rewrite is supposed to be enabled on godaddy servers and that but when i make the changes and try it i just get the html page loaded and not the redirected php catagory page etc

and the html page is displayed in addresss bar and main site index page is actually what is displayed

i also heard that the .htaccess page takes a long time to update and something to do with godaddy being slow soemthing to do with php and .htaccess and stuff like that
anyone help any ideas?

*****updated*****

to all those using godaddy do the modifications in .htaccess and upload wait 5-10 minutes then upload modified sessions file and it all works

*****updated*****

Michael
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Beautiful Body Castings on June 15, 2006, 03:30:05 AM
ok read the entire post all of them and im a little confused

i got the origional mod working

my site now directs to gallery{id}.htm etc(i changed cat to gallery) anyway on all pages of my site i get the problem with the drop down box to go to different catagories firstly i want to know why it goes automatically without need to pres the go button, why have the go button??

secondly why when it goes to page it just goes to gallery.htm without the id of the catagory (it loads the correct catagory etc but address bar just says mysite etc gallery.htm)

can anyone please help

also is there a good solid mod download or single description for doing the second version with catagory and image names in the .htm page name  so i would have something like gallery-{galleryname}-{id}.htm and similar for images

as its all over this posts and i cant make out which bits go where when im reading several posts

thanks

Michael
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Jedigaz on June 15, 2006, 05:52:00 PM
Dunno if i should post this here but the day after i did this `mod` im getting this error wih no thumbs on main page and this error above my banner



Warning: session_start(): open(/tmp/sess_3fed97d856e790dc7dff1bd387b34c2f, O_RDWR) failed: Permission denied (13) in /home/gazfxcom/public_html/includes/sessions.php on line 86

DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name FROM (4images_images i, 4images_categories c) LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (0) ORDER BY i.image_date DESC LIMIT 20
Can't create/write to file '/tmp/#sql_1421_0.MYI' (Errcode: 13)
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/gazfxcom/public_html/includes/db_mysql.php on line 116




i have no idea as to why this is happening because my site www.gazfx.com has been working fine up until just a couple of hours ago..any help as always greatly appreciated
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Jedigaz on June 15, 2006, 06:58:28 PM
It is now working again but all on its own..the error isnt there anymore and the thumbs have returned...

why i am i posting u may ask..

basically because i am interested to know why this happened so i can learn..
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on June 16, 2006, 01:16:51 AM
Something happend on the server, perhaps MySQL crashed.
When you see errors about .MYI files, first thing you should do is contact your host administrator so they could investigate the failure and while they do that you can try repair the tables in the database from phpmyadmin or any other mysql manager.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bydlo on June 29, 2006, 03:23:18 PM
moin moin,
bruchte zu diesem thema auch mal hilfe.
habe wie in dem eingangspost beschrieben die session.php vendert.

habe die htaccess ins verzeichnis gelegt in dem die installation liegt.

habe sowohl die versionen mit rewrite base (auch auskommentiert) als auch ohne versucht.

die session IDs sind immer noch da.

hier mal meine htaccess
Quote
# Begin search engine friendly links code
RewriteEngine On
# RewriteBase /download/
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}

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

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}

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

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

# End search engine friendly links code

die URL der anwendung:
www.axellauer.de/download/

PS: zur vorbeugung von missverstnden.
die anwendung liegt zwar schon auf meinem server ist aber noch nicht verlinkt (also nicht ffentlich)

gruss axel
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: idijotaz on July 02, 2006, 11:34:27 AM
After mod installation, is it possible to show images with old adress and new? becouse i need a little old links. And what link should be if ussing multi lang for all names?  :lol:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on July 02, 2006, 11:43:01 AM
yes, the "old way" will stay intact
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: idijotaz on July 02, 2006, 03:10:25 PM
Ok installed.. but how to make paging like in vano site? /cat1.2? and how to make dont show that .html like in vano site? :roll:
and how u make language in /en/page?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: unite on July 06, 2006, 08:54:41 AM
Works Perfect, thank you... www.vistawallpapers.ws
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: KimmyMarie on July 10, 2006, 04:54:26 PM
Hey people,

I've noticed a lot of you have asked a way to completely remove sessionid's, as google DOES NOT like it.

Just add this somewhere in your .htaccess:

Code: [Select]
php_value session.use_cookies 1
php_value session.use_only_cookies 1
php_value session.use_trans_sid 0

Just add it at the very end of your .htaccess (for instance), and session id's are gone for good :D

getting internal server error 500 :(
Can you show your htaccess file here (or PM it to me if you don't want it out in public)


I tried this and I also get "500 Internal Server Error error"


The only lines in my .htacess are:

php_value session.use_cookies 1
php_value session.use_only_cookies 1
php_value session.use_trans_sid 0


Could this be my server not allowing me to include that code?



Thanks,
Kim
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: unite on July 11, 2006, 05:23:08 PM
Ok found a little problem. I run a box with ENSIM on it so when you go to www.vistawallpapers.ws/admin it brings you to the admin ensim CP of the site. Well when you login to the 4homepages CP (site cp) and try to edit a wallpaper it tries to go to www.vistawallpapers.ws/admin and not the edit image area in the scripts CP. I know I have fixed this before on other VB installs but I dont know where to change the code to fix this in 4homepages script.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on July 12, 2006, 01:05:34 AM
and where the actual link pointed to? if its pointed to www.vistawallpapers.ws/admin instead of to www.vistawallpapers.ws/admin/images.php?action=blah then most probably its due to some other changes you made to the code, cause with original code all links in ACP will stay the same as without the mod.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: unite on July 12, 2006, 10:17:36 PM
and where the actual link pointed to? if its pointed to www.vistawallpapers.ws/admin instead of to www.vistawallpapers.ws/admin/images.php?action=blah then most probably its due to some other changes you made to the code, cause with original code all links in ACP will stay the same as without the mod.

Its pointing to this addy...
http://www.vistawallpapers.ws/admin/?goto=images.php
It works if you go to http://www.vistawallpapers.ws/admin/images.php
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on July 13, 2006, 01:24:00 AM
Is this with the original code (mod) or you've changed something?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: unite on July 13, 2006, 04:15:55 AM
I havent changed anything other than add this mod.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: idijotaz on July 15, 2006, 07:43:22 PM
Ok installed.. but how to make paging like in vano site? /cat1.2? and how to make dont show that .html like in vano site?  :roll:
and how u make language in /en/page?
anybody can help me?  :lol:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: live@ct on July 17, 2006, 05:38:37 PM
Hi this script work excellent, now I have a problem  :( I bought another domain and I like to use like alias but I have an error with this script, I don't know why, but I cant see the images, only the simple and normal links, for example, newdomain.com/register.php, newdomain.com/details.php?image_id=1383 I can acces if i put the urls normaly without this cript,  newdomain.com/img1234.html using this script send me a file not found error

what changes I need to do, to make it work the short urls script in the new domain


thanks for your help
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on July 18, 2006, 03:27:10 AM
same server different domain? what is your setup?
what do the error logs say? if in the error logs say that /full/path/img1234.html not found that means either mod_rewrite is not installed/activated or your .htaccess not working properly...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: live@ct on July 18, 2006, 07:54:00 AM
it showme the default file not found server error
I think that its something with the rewrite mod because in my original domain all works propertly
Now if I enter to my site by the new alias domain the images and categories are not showing, only if I access normaly using de original url (details.php?image_id=1234)
and the single files like register.php. index.php?template=FAQ, and all the files that are not linked to the images and categories works propertly

this is mi htaccess code

#begin 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 ^img([0-9]+)\.html$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^img([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}

#end code


thanks for your help
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: mass27 on July 25, 2006, 10:50:45 AM
I'm trying to follow the guide at the first thread LINK HERE (http://www.4homepages.de/forum/index.php?topic=6729.0) but couldn't find the code to replace. I searched for code starting [qcode]function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];[/qcode] in includes/sessions.php but didn't find anymore in Version 1.7.3 (the latest version). Have the includes/sessions.php file changed in the latest version and if so could you please tell me how to MOD it to Search Engine Friendly URLs aka Short URLs?

Thank you in advance!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: live@ct on August 02, 2006, 12:29:16 AM
How can I generate the short url to used with the info, something like: {image_short_url} and this display the link to the image but using short url

thanks for your help
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on August 02, 2006, 01:06:57 AM
I have no ideat what is that you are asking about...display where?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: sajwal on August 03, 2006, 05:34:30 AM
People who are using 1.7.3 ,

I tested both the versions of this MOD ... ie Page 1 and Page 14 ,

Please note :  the pg. 14th mod is not working for 1.7.3
------------------------------------------------------------------------------------------
i can be happy with the pg.1 but need to know does the 14th pg. mod is better in terms of SEO if yes ... pls. help the coding for 1.7.3 as well.


Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Panther_1 on August 10, 2006, 11:27:29 AM
I think it is time to get Search Engine Friendly URL's in the main distirbution.
For this I open an topic in the Feedback & Suggestions Forum.

There are no comments from any developer so far but from some user who want this too.


Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lover2 on August 13, 2006, 12:42:01 AM
hello
can i use mod sef urls  for 4image gallery 1.7.3
i am not profession  :oops:
please guide me step by step  (http://qsmile.com/qsimages/20.gif)
sorry for my english
thank you
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: sajwal on August 13, 2006, 01:05:06 AM
hello
can i use mod sef urls for 4image gallery 1.7.3
i am not profession :oops:
please guide me step by step (http://qsmile.com/qsimages/20.gif)
sorry for my english
thank you

Yes, you can use for 1.7.3 but the first 1st page mod . i am using it, works fine for me
but found problem using the 14th page mod
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lover2 on August 13, 2006, 01:44:41 AM
hi
i use it for 1.7.3
but it say this error in header gallery

Code: [Select]
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/woh06000/public_html/4imagegallery/includes/sessions.php:1) in /home/woh06000/public_html/4imagegallery/includes/sessions.php on line 84

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/woh06000/public_html/4imagegallery/includes/sessions.php:1) in /home/woh06000/public_html/4imagegallery/includes/sessions.php on line 84

Warning: Cannot modify header information - headers already sent by (output started at /home/woh06000/public_html/4imagegallery/includes/sessions.php:1) in /home/woh06000/public_html/4imagegallery/includes/sessions.php on line 92

Warning: Cannot modify header information - headers already sent by (output started at /home/woh06000/public_html/4imagegallery/includes/sessions.php:1) in /home/woh06000/public_html/4imagegallery/includes/sessions.php on line 92

Warning: Cannot modify header information - headers already sent by (output started at /home/woh06000/public_html/4imagegallery/includes/sessions.php:1) in /home/woh06000/public_html/4imagegallery/includes/sessions.php on line 92


what is the problem ?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on August 13, 2006, 02:05:03 AM
you have something above/before <?php in includes/sessions.php
Perhaps you edit in a editor that uses UTF-8/UNICODE encoding and it saves so-called "BOM" info with the file. (Notepad/wordpad can do that). Make sure when you save the file, it saves in ASCII encoding.

Another possibility is that you uploaded modifyed .php files in binary mode and not in ASCII (text).
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lover2 on August 13, 2006, 02:44:30 PM
hello
tnx for your guide (it work for my gallery )tnx

i have another question
this is my gallery www.freertl.com/4imagetest
how can i change link categories and image
for exapmle
http://www.freertl.com/4imagetest/img2.htm

to this :
http://www.freertl.com/4imagetest/madonna.htm
or
http://www.freertl.com/4imagetest/cat-madonna.htm

 (http://qsmile.com/qsimages/42.gif)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on August 13, 2006, 07:53:22 PM
please start reading the replys, we've discussed this already and there is a working code somewhere in the replys...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lover2 on August 14, 2006, 12:27:12 AM
hi
i use this code: http://www.4homepages.de/forum/index.php?topic=6729.msg57268#msg57268
but my gallery have a problem it say this error :
Code: [Select]
Fatal error: Call to undefined function get_category_url() in /home/woh06000/public_html/4imagetest/includes/sessions.php on line 456

you can see my gallery with error: http://www.freertl.com/4imagetest
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on August 14, 2006, 12:41:14 AM
hmmm...what if you add the code in step 2 into includes/functions.php instead of includes/sessions.php ?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lover2 on August 14, 2006, 12:57:09 AM
i add this code
Code: [Select]
//Mod_bmollet
/**
* Get the category url
* @param int $cat_id The id of the category
* @param string $cat_url The current status of the URL
*/
function get_category_url($cat_id,$cat_url = '')
{
global $site_db;
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['cat_name'] = strtr($row['cat_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$cat_url = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
* Get the image url
* @param int $image_id The id of the image
*/
function get_image_url($image_id)
{
global $site_db;
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['image_name'] = strtr($row['image_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
// if you want comlpete path to image in url, remove comment from following line
//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}
in the includes/sessions.php
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: scooze on August 16, 2006, 11:42:11 PM
so there is still no solution with paging problem?

hot to make a "cat1_2.htm" out of "cat1.htm?page=2"

 :?:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: arindra on September 02, 2006, 01:52:18 AM
i have been long bugged by this ... the seo url works fine on my site but when a user runs a search and it generates result pages with 3-4 pages , it doesnt work on clicking the 2nd page link. it takes them to the advanced Search
However pagination works fine on normal category pages with multiple pages
anyone have any advice ?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on September 02, 2006, 02:36:40 AM
what is the difference in the seo and normal urls for the second page?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Brainwrek on September 02, 2006, 05:06:42 AM
This should be easy, but I haven't found a solution yet...

How to use .htaccess to rewrite the Keywords links from this:
Code: [Select]
<a href=" http://www.site.com/photos/search.htm?search_keywords=dogs_cats">DOGS & CATS</a>
To this:
Code: [Select]
<a href=" http://www.site.com/photos/keywords/dogs_cats">DOGS & CATS</a>
I would love to have this!!!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Bugfixed on September 09, 2006, 05:04:30 PM
hello all.

I have big problem. my problem is this system is showing doesnt lacking pages.
for example: there is no addresses like http://www.lavinya. net/galeri/img19933.htm :(
but it is showing . redirect to main page (with 302 status code).

file not 302, it must be 404 status code. this is spam I think.  8O

please help me  :?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on September 09, 2006, 07:07:36 PM
I didnt understand...how is that related to this mod?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: xec on September 17, 2006, 08:25:58 AM
Djith and me ordered this mod, to put image name and category name in url.
After testing and debugging, we think it is ok now, and we are happy to share it with you.


This mod puts the names of the categories and the images in the url like this :
for image --->http://www.your-site.com/img-imagename-andnumber.htm
category --->http://www.your-site.com/cat-categoryname-andnumber.htm

you can see it working on http://www.edupics.com (1.7) and http://www.avatarcorner.com (1.7.1)
on these sites the "img" and "cat" in the url were changed to some keywords.
( see http://www.4homepages.de/forum/index.php?topic=6729.msg41243#msg41243 )


there is also the possibility to make url's with full path to image and categories : ( see //comment in mod )
for image --->http://www.your-site.com/img-full path to image.htm
category --->http://www.your-site.com/cat-full path of category.htm
This was not tested on our sites.


Don't forget to backup your files before editing !

files to be edited :
.htaccess
includes/sessions.php

Code: [Select]
 
=================================================
1. at the end of .htaccess, add following code :
=================================================
#Mod_bmollet : category name in URL
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}

#Mod_bmollet : This is to make search function work  ( redirect links from search results )
RewriteRule ^img([0-9]+).search.htm details.php?image_id=$1&%{QUERY_STRING}

=======================================================================

=========================================
2. add this code to include/sessions.php
=========================================
//Mod_bmollet
/**
 * Get the category url
 * @param int $cat_id The id of the category
 * @param string $cat_url The current status of the URL
 */
function get_category_url($cat_id,$cat_url = '')
{
global $site_db;
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['cat_name'] = strtr($row['cat_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$cat_url  = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
 * Get the image url
 * @param int $image_id The id of the image
 */
function get_image_url($image_id)
{
global $site_db;
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['image_name'] = strtr($row['image_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
// if you want comlpete path to image in url, remove comment from following line
//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}
========================================================================

========================================================================
3. In include/sessions.php replace function url(...) by following code.
========================================================================
/* ORIGINAL CODE
  function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }
*/
  function url($url, $amp = "&amp;") {
    global $l, $user_info;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];
    $url = str_replace('&amp;', '&', $url);
    if (!defined('IN_CP')) {
      if (strstr($url, 'index.php')) {
        $url = str_replace('index.php', '', $url);
      }
      elseif (strstr($url, 'search.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('search.php', 'search.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('search.php', 'search.htm', $url);
        }
      }
      elseif (strstr($url, 'lightbox.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('lightbox.php', 'lightbox.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
                $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('lightbox.php', 'lightbox.htm', $url);
        }
      }
      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];
            $cat_url = get_category_url($matches[1]);
            $url   = str_replace('categories.php', 'cat'.$cat_url.'.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);
        }
      }
      elseif (strstr($url, 'details.php?image_id=')) {
        if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
          preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
          if (isset($matches1[1]) && isset($matches2[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php', 'img'.$matches1[1].'.'.$matches2[1].'.htm', $url);
            $query = str_replace('image_id='.$matches1[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches1[1], '', $query);
            $query = str_replace('image_id='.$matches1[1], '', $query);
            $query = str_replace('mode='.$matches2[1].'&', '', $query);
            $query = str_replace('&mode='.$matches2[1], '', $query);
            $query = str_replace('mode='.$matches2[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php', 'img'.get_image_url($matches[1]).'.htm', $url);
            $query = str_replace('image_id='.$matches[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches[1], '', $query);
            $query = str_replace('image_id='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
      }
      elseif (strstr($url, 'postcards.php?image_id=')) {
        preg_match('#image_id=([0-9]+)&?#', $url, $matches);
        if (isset($matches[1])) {
          $split = explode('?', $url);
          $url = $split[0];
          $query = @$split[1];
          $url   = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
          $query = str_replace('image_id='.$matches[1].'&', '', $query);
          $query = str_replace('&image_id='.$matches[1], '', $query);
          $query = str_replace('image_id='.$matches[1], '', $query);
          if (!empty($query)) {
            $url .= '?' . $query;
          }
        }
      }
    }
    if ($this->mode == "get" && strstr($url, $this->session_id)) {
      $url .= strpos($url, '?') !== false ? '&' : '?';
      $url .= SESSION_NAME."=".$this->session_id;
    }
    if (!empty($l)) {
      $url .= strpos($url, '?') ? '&' : '?';
      $url .= "l=".$l;
    }
    $url = str_replace('&', $amp, $url);
    $url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
    return $url;
  }
========================================================================


========================================================================
4. In include/sessions.php following functions are useful for URL's like
   yoursite.com/maincategory/subcategory/imagename.htm
   
   This is not necessairy if you want url's (like we used on our sites) like this :
   for image --->http://www.your-site.com/img-imagename-andnumber.htm
   category --->http://www.your-site.com/cat-categoryname-andnumber.htm
========================================================================
//Mod_bmollet
/**
 * Get the category id
 * @param array $path An array with the path of the category
 * @param int $parent_id The parent id of the first item in the $path
 */
function get_category_id($path,$parent_id = 0)
{
$cat_name = array_shift($path);
global $site_db;
$sql = "SELECT cat_id FROM ".CATEGORIES_TABLE." WHERE cat_parent_id = $parent_id AND cat_name = '".mysql_real_escape_string($cat_name)."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
if( count($path) != 0)
{
return get_category_id($path,$row['cat_id']);
}
else
{
return $row['cat_id'];
}
}
//Mod_bmollet
/**
 * Get the image id
 * @param array $path An array with the path of the image
 */
function get_image_id($path)
{
global $site_db;
$image_name = array_pop($path);
$cat_id = get_category_id($path);
$sql = "SELECT image_id FROM ".IMAGES_TABLE." WHERE image_name = '".mysql_real_escape_string($image_name)."' AND cat_id = $cat_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
return $row['image_id'];
}
========================================================================


Hello,

Has someone gotten this to work with 1.7.2 ? Thank you.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: vBFreak on September 17, 2006, 08:37:12 AM
Heh, that's exactly what I was looking for, thanks a lot :)

How can I replace member urls to http://www.domain.de/members/username ? (Also special chars like . or , or umlauts should be removed and spaces should be re-written to -)

Would also be good to be able to rewrite http://www.domain.de/cat56.html?page=2 to http://www.domain.de/cat56_2.htm

As far as I can see google still craws on dynamic urls, will they stop using those old ones after a while and will add the new html ones then instead?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: xec on September 18, 2006, 02:27:12 AM
Heh, that's exactly what I was looking for, thanks a lot :)

How can I replace member urls to http://www.domain.de/members/username ? (Also special chars like . or , or umlauts should be removed and spaces should be re-written to -)

Would also be good to be able to rewrite http://www.domain.de/cat56.html?page=2 to http://www.domain.de/cat56_2.htm

As far as I can see google still craws on dynamic urls, will they stop using those old ones after a while and will add the new html ones then instead?
So you're saying you got for image --->http://www.your-site.com/img-imagename-andnumber.htm
category --->http://www.your-site.com/cat-categoryname-andnumber.htm working on your 1.7.3 4images site?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: vBFreak on September 18, 2006, 02:20:41 PM
No, I'm using 4images 1.7.2 with the security fixes because I'm using a special integration to my vBulletin Forums, the sessions.php from 1.7.3 differs from the one of 1.7.2, thus I'm unable to update my 4images until a new, up to date Version of my integration mod is released.

I'm using the version from the first post in this thread, I didn't get the one from page 14 to work, I think that was the one you mentioned.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: xec on September 19, 2006, 06:18:19 PM
No, I'm using 4images 1.7.2 with the security fixes because I'm using a special integration to my vBulletin Forums, the sessions.php from 1.7.3 differs from the one of 1.7.2, thus I'm unable to update my 4images until a new, up to date Version of my integration mod is released.

I'm using the version from the first post in this thread, I didn't get the one from page 14 to work, I think that was the one you mentioned.
Sorry, I meant to ask if you got the page 14 one to work with 1.7.2 but I guess you answered for me. So what mod is it that you're using? The user integration mod?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: live@ct on September 20, 2006, 10:44:30 AM
I install the second MOD of this (Page 14) but I get this error:

Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/content/html/includes/sessions.php on line 626

And returning to my last problem, (I added an alias domian to my actual site and the original MOD didnt work) when I acces aliasdomian.com/cat3.html it showme a ERROR 404 file not found, but if I acces aliasdomain.com/categories.php?cat_id=3 it works fine

thanks for your help
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: saadahmed007 on September 20, 2006, 06:18:48 PM
Hi Vano,
I am getting 404 error on the site
http://www.t-mobile-t.com/
on images if you look into it
Will really apperciate your guidence :)
Thanks and Regards,
Saad
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on September 21, 2006, 01:09:14 AM
404 error is not usefull untill you look in the logs ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: adrianus on September 21, 2006, 07:28:37 PM
hi to all

So the mod at 14th page still doesn't work with 1.7.3... is it right?

Are there any SEF solutions for 1.7.3 (i don't like the 1th page one).

thanks to all
AD
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: live@ct on September 27, 2006, 09:57:25 AM
Hi

I add the next line to my httacces

RewriteRule ^([a-zA-Z0-9_\-]+)\.html$ index.php?template=$1&%{QUERY_STRING}

now I cant retrive a simple html out of the script of 4images

someone can help me with this error?!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on September 28, 2006, 03:16:22 AM
1) page 14 - might be different for everyone, it depence on personal settings on this forum so, please post a url to the reply you are talking about instead.
2) you've made a misstake when modifyed sessions.php perhaps missed { or }
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: IWS_steffen on October 16, 2006, 10:29:32 PM
Hallo

hat jemand schon mal eine .htaccess auf einer Subdomain unterzubringen.

Bei der Hauptdomain kplappt es mit einer .htaccess (es liegt also nicht am Server)

Durch die umgebaute sessions.php zeigt der neue Pfad zwar super .htm an, aber es wird die Error 404 Seite gezeigt.

Vielleicht ein Tipp?


Gru Steffen
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: IWS_steffen on October 17, 2006, 06:11:30 PM
Hallo,

mir wre auch schon wirklich geholfen, wenn ich die Bilder in der detail.php nicht mit image_id sondern z.B. reisebericht_id abspeiern knnte.

In welcher php wird denn die image_id festgelegt?

Gru Steffen
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: amir on October 20, 2006, 09:30:41 AM
Excellent Code.

Thanks So much friend!!

 :thumbup:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: adrianus on October 28, 2006, 02:39:52 PM
Do you have 14th page SEF code working on your 1.7.3 or 1.7.4 ?

Still i can't have it working on 1.7.4 (it was ok on 1.7.1)

:(

AD
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: live@ct on November 03, 2006, 06:46:53 AM
Everything its working now!!  :D :D :D

The only thing that I like its to remove the img and image_id prefix and show only the image_name.html or remove the image_id to have img-image-name.html

I search page by page but i didnt found the code to change that
any one ?! :P
thanks for your help!!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: tmcguire on November 07, 2006, 09:45:03 PM
Has the first post in this thread been updated with the latest updates of the thread conversation?

I am very confused after reading about 15 pages of this thread and can't keep track of the changes and don't know if post #1 has had been edited to include all of the changes throughout the entire thread.

/me is CONFUSED!

-Tom
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Acidgod on November 07, 2006, 09:47:08 PM
Has the first post in this thread been updated with the latest updates of the thread conversation?

Letzte nderung: Februar 05, 2006, 21:06:11 von V@no

I don't think so...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: live@ct on November 16, 2006, 09:59:33 AM
Please help me!!

I check and try to remove the image_id of the URL for the images and for the categories

I like to change:

site.com/img-imagen1-1.html
site.com/cat-1.html

to:

site.com/img-imgen.html
site.com/categorie.html or site.com/categorie/

please help me!!!!
:(

thanks for your help!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: goldcoin on November 26, 2006, 06:58:40 PM
I've installed the mod published on page 14 and it's really changed the urls,
The only problem is when i click on a category i'm getting "error - page not found"
What could be the problem?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Zyga on December 01, 2006, 08:10:38 PM
HI
Thank You for a this mod.
It works great with 1.7.4.

Now some questions.

1. How can i change profile links to short?
In my htaccess is
Code: [Select]
RewriteRule ^profile([0-9]+)\.htm$ member.php?action=showprofile&user_id=$1&%{QUERY_STRING}but they are stil
Code: [Select]
http://localhost/4images/member.php?action=showprofile&user_id=70
should i chande something in sessions.php?

2.I found here question about problems with dropdown form but i cant find answer 
Its strange my dropdown works for all cattegories but there is always one url
Code: [Select]
http://localhost/4images/cat.htmHow can I add here cat id?

3. When I use search there is always same url
Wow can I add searching word to URL?
Code: [Select]
http://localhost/4images/search_xxxx.htmxxxx- searching word
and same for user search

----------- edit -----------------------

add1

in sessions.php
before
Code: [Select]
elseif (strstr($url, 'postcards.php?image_id=')) {
add
Code: [Select]
      elseif (strstr($url, 'member.php?action=showprofile&user_id=')) {
                preg_match('#user_id=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $url   = str_replace('member.php', 'profile'.$matches[1].'.htm', $url);
          }

return $url;
}
Now short urls for profiles works and looks like
Code: [Select]
http://localhost/4images/profile49

And now I planing to make them like
Code: [Select]
http://localhost/4images/nick/profilelater planing
Code: [Select]
http://localhost/4images/search.htm?search_user=nickchange in to
Code: [Select]
http://localhost/4images/nick/gallery
If someone could help...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: menes on December 18, 2006, 10:53:09 AM
xec  ,  we try codes which you give in 14. page.. 
İt is perfect  :) thanks  but   only   step 4.  is not work
Our adress show  always   www.site-name.com/cat-category.htm    or www.site-name.com/img-imagename.htm
But we want to show www.site-name.com/catname/subcatname/imagename.htm 
How we can do this?
And my second problem is  i want to use   şğ...   letters  in adress   exm. www.site-name.com/ortşş.htm   how we can do it??
Thanks
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: nobita on December 30, 2006, 05:33:04 PM
xec  ,  we try codes which you give in 14. page.. 
İt is perfect  :) thanks  but   only   step 4.  is not work
Our adress show  always   www.site-name.com/cat-category.htm    or www.site-name.com/img-imagename.htm
But we want to show www.site-name.com/catname/subcatname/imagename.htm 
How we can do this?
And my second problem is  i want to use   şğ...   letters  in adress   exm. www.site-name.com/ortşş.htm   how we can do it??
Thanks

Great question!

I want do it too.

Please help us!

Thank a lot!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on January 29, 2007, 02:16:41 AM
Hello again!

I am using versuion 1.7.1
MOD of first page is working great for me.

MOD on page 14 (kief) i receive following error:
Code: [Select]
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/content/html/includes/sessions.php on line 626

Perhaps i have made something wrong.
Where do i have to put in the 2. code tags exactly?

I am also using MOD lang-select. Could be a problem with the code according to this MOD?

I am not a coder, only a question or idea.
Is it not possible to build in the "clickstream-tag" as URL? :idea:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: nobita on February 01, 2007, 01:52:25 PM
Please help me!!

I check and try to remove the image_id of the URL for the images and for the categories

I like to change:

site.com/img-imagen1-1.html
site.com/cat-1.html

to:

site.com/img-imgen.html
site.com/categorie.html or site.com/categorie/

please help me!!!!
:(

thanks for your help!

I want this too. But for category only (beacause the file name can be existed).

Please help us!

Thank you!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Acidgod on February 01, 2007, 02:15:23 PM
This is not so easy and associated with heavy modification...

Without the IDs the Script doesn't now which Cat or Img you mean....
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: myr2904 on February 06, 2007, 01:30:04 AM
Hy,
I like to change
site.com/cat-catname-id.htm to site.com/catname-id.htm
How can i do that?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on February 06, 2007, 11:18:15 PM
My webhoster today was updating PHP Version 5.1 to Version 5.2.

Now all my category and image links not working anymore also the HTML-Links.

I am using MOD of page 1 in this topic.

SO what is the problem now.
My .htaccess?

Please help me!

I attached my current sessions.php and .htaccess files.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on February 07, 2007, 12:23:46 AM
Thanks for help!
I solved the prob.
Deleting this MOD from Page 1 and 9, also .htaccess file.
Now it is working again.
 :D
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: myr2904 on February 07, 2007, 10:55:42 AM
Hy,
I like to change
site.com/cat-catname-id.htm to site.com/catname-id.htm
How can i do that?
Does anyone know?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: drastx on February 07, 2007, 04:26:41 PM
Hey.

I have link like this:
http://ojejku.net/img-tapety-30-resplendent_ether-1454.htm

So it's
 img-catname-catid-imagename-imageid.htm


How can i change this into
tapety/resplendent_ether.htm or tapety-resplendent_ether.htm
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Acidgod on February 09, 2007, 06:11:50 PM
Without the IDs the Script doesn't now which Cat or Img you mean....
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: lolak on February 13, 2007, 02:52:14 AM
Cool modul, work well for my photo gallery Gadis Photo (http://www.gadisphoto.com) with install version 1.7.4
thanks  8)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Zyga on February 18, 2007, 09:59:11 PM
After instaling this mod my category_dropdown_selfjump won't work :/
Please check it on my gallery (http://my gallery) <- link
Dropdown is just under search form on he left
Url result is
Quote
http://say10.pl/cat
and it should be for example
Quote
http://say10.pl/cat49.htm
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: kowalski on March 01, 2007, 02:37:53 AM
Just spent the past couple of hours reading through all 26 pages in this thread... phew!

Does the code on page 14 by kief24 (http://www.4homepages.de/forum/index.php?topic=6729.msg57268#msg57268) work okay with v1.7.4 ?



To V@no
(firstly thank you for a wonderful piece of software, and your help on the forums!)
-- you say that changing the URL from 4images/cat12.htm to 4images/category/imagename-ID.htm isn't necessary for SEO ... does this thread not convince you that most users would love to have this feature as standard?
In my opinion, it is very useful for SEO purposes to have the 2nd examples URL structure

I think it would be helpful to have kief24's code in a new thread, or at least more prominent on the forum, to save people having to dig through 26 pages (and keep re-asking the same questions!)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: bibabobu on March 06, 2007, 10:27:59 AM
 :D Ok I am using 4images version 1.7.4 on PHP 5.2.1 and the original Mod of page 1, top of page2, page6 and page9. (NOT Page14 Kief)
Everything seems to be working fine!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: egyptsons on March 12, 2007, 03:43:08 PM
:D Ok I am using 4images version 1.7.4 on PHP 5.2.1 and the original Mod of page 1, top of page2, page6 and page9. (NOT Page14 Kief)
Everything seems to be working fine!
Same is here
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: onur999 on March 29, 2007, 11:27:52 AM
change sessions.php

admin panel error.

Code: [Select]
An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

Warning: Cannot modify header information - headers already sent by (output started at /home/salgitc/public_html/saderesim/includes/db_mysql.php:192) in /home/salgitc/public_html/saderesim/admin/admin_functions.php on line 168

Warning: Cannot modify header information - headers already sent by (output started at /home/salgitc/public_html/saderesim/includes/db_mysql.php:192) in /home/salgitc/public_html/saderesim/admin/admin_functions.php on line 169

Warning: Cannot modify header information - headers already sent by (output started at /home/salgitc/public_html/saderesim/includes/db_mysql.php:192) in /home/salgitc/public_html/saderesim/admin/admin_functions.php on line 170

Warning: Cannot modify header information - headers already sent by (output started at /home/salgitc/public_html/saderesim/includes/db_mysql.php:192) in /home/salgitc/public_html/saderesim/admin/admin_functions.php on line 171

Warning: Cannot modify header information - headers already sent by (output started at /home/salgitc/public_html/saderesim/includes/db_mysql.php:192) in /home/salgitc/public_html/saderesim/admin/admin_functions.php on line 172

index.php error!

Code: [Select]
An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.



Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: adrianTNT on March 29, 2007, 10:56:13 PM
Hello.
I applied the mod and worked without any problems.

Can somoeone please tell me how to modify this? I am sure more users asked but I could not find a solution.

- How can I made it show cat_name.html in address bar rather than car_numbe.html ?
- How could I make it show cat_name/photo_title.html ? (This one probably needs the photo number appended before .html because photo titles are not unique)

I would like:
site.com/Porsche/
and
site.com/Porsche/porsche_carrera_5435.html

Can anyone help? Thank you very much.
- Adrian.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: adrianTNT on March 31, 2007, 12:40:53 AM
Anyone ^? Does this require many modifications?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: sbsreddy on April 05, 2007, 09:04:58 PM
It took me 1 full day to read all the 26  threads. the page 1 mod works fine. however i like to have category/subcategory/image-name.htm in the URL. i have implemented page 14 but wothout success. then i have backed up my sessions.php file to restore my site. since my site http://www.celebvilla.com/index.php deals with celebrities, i definitely look for a mod to show categories/subcategories. If anybody succeeded in implementing page -14 mod. pl give us an updated fresh mod, so that we need not be subjected to spend so much time for nothing.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: alvaro0022 on April 10, 2007, 09:34:25 AM
Hello to all I have installed mod but nonprofit that works to me It appears to me the following error  :cry:

Forbidden
You don't have permission to access /a on this server.


--------------------------------------------------------------------------------

Apache/2.0.52 (Red Hat) Server at www.fondosdepc.com.ar Port 80

somebody I could be helped
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: laurica on April 12, 2007, 09:27:20 PM
After instaling this mod my category_dropdown_selfjump won't work :/
Please check it on my gallery (http://my gallery) <- link
Dropdown is just under search form on he left
Url result is
Quote
http://say10.pl/cat
and it should be for example
Quote
http://say10.pl/cat49.htm

I have the same problem. I searched a solution but couldn't find it on this forum; here's my category_dropdown_form.html

<form method="post" name="jumpbox" action="{url_categories}">
  <table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td valign="bottom">{category_dropdown_selfjump}</td>
      <td valign="top">
        <input type="submit" value="{lang_go}" class="button" />
      </td>
    </tr>
  </table>
</form>

any ideas?
Title: I pay $30 :)
Post by: adrianTNT on April 13, 2007, 02:47:11 PM
I will pay $30 by PayPal for this mod (if is without bugs):
Like other people I need this:

1. Category and sub category names in the url instead of 'cat_120.htm':

gallery/cat120.htm
to become
/gallery/lamborghini/
and
/gallery/muscle_cars/dodge/


2. Url of image details to show image name and it's category/sub category:

/gallery/img_120.htm
to become
/gallery/lamborghini/countach_43543.html
and
/gallery/muscle_cars/dodge/black_dodge.htm

Can anyone do this? I can pay by PayPal. I will need the exact instructions for where to modify rather than the modified scripts.
Thank you.

- Adrian.
Title: Re: I pay $30 :)
Post by: Safariguy on April 14, 2007, 10:33:42 PM
I will pay $30 by PayPal for this mod (if is without bugs):
Like other people I need this:

1. Category and sub category names in the url instead of 'cat_120.htm':

gallery/cat120.htm
to become
/gallery/lamborghini/
and
/gallery/muscle_cars/dodge/


2. Url of image details to show image name and it's category/sub category:

/gallery/img_120.htm
to become
/gallery/lamborghini/countach_43543.html
and
/gallery/muscle_cars/dodge/black_dodge.htm

Can anyone do this? I can pay by PayPal. I will need the exact instructions for where to modify rather than the modified scripts.
Thank you.

- Adrian.

To "sweeten" the pot I will pay the same for a working install of this mod using ver 1.7.4. I can email you the files for you to make the changes as I have made some customizations for my site.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Acidgod on April 14, 2007, 10:50:50 PM
Guys this will not work!!! Read some of the previews Post...  :roll:

01.02.2007 and 09.02.2007 i wrote:

Without the IDs the Script doesn't now which Cat or Img you mean....

Without the cat id and image id it will not work!
And modify it to get it work without the cat_id for 30$???

No way... (o:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: laurica on April 15, 2007, 05:42:49 PM
ok, but what about the category_dropdown_form.html? is it working on your gallery?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: silgitsin on April 23, 2007, 01:09:08 AM
great work ..thanks a lot..
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: rinaldos on April 25, 2007, 02:09:12 AM
Hallo zusammen.

Heute ist mir zufllig aufgefallen, das mein Clickstream, egal ob aus der Kategorie oder der Detailansicht immer auf den ROOTPFAD verweist und nicht auf die index.php.
Ich habe alle configs durchgeschaut (detail.php, index.php), aber irgendwie finde ich den Fehler nicht.

Als Startdatei nutze ich eine index.htm die auf das entsprechende Template verweist. Klicke ich auf HOME im Clickstream lande ich wieder auf der index.html und nicht auf der index.php :-(
details.php

Code: [Select]
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];


Derzeit habe ich es so gelst, damit ich ber home auf meine index.php komme:
im template home.html
Code: [Select]
<td>&nbsp&nbsp<a href="/index.php"><span class="smalltext2">Galerie</a><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" /><span style="color:#EAFF27;font-size: 11px;font-family:Tahoma">{clickstream}</span></td>in der betreffenden php Datei:
Code: [Select]
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\"></a>".$config['category_separator'].get_category_path($cat_id)."</span>";
Aber da muss es doch eine andere Lsung fr geben, oder?

Ich hatte dieses schon hier einmal gepostet:
http://www.4homepages.de/forum/index.php?topic=17284.new;topicseen#new (http://www.4homepages.de/forum/index.php?topic=17284.new;topicseen#new) und Kurt meinte das es an diesem MOD liegen knnte.

Hier ein nicht gendertes Template. Klickst du auf HOME im Clickstream landest du wieder ganz am Anfang :-(

http://rinaldos.homeip.net/guestbook.php (http://rinaldos.homeip.net/guestbook.php)


Gruss Ingo
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: drastx on April 28, 2007, 11:59:49 AM
Hello

I need help...
My problem is - look what pages Google indexes on my site - http://www.google.com/search?client=firefox-a&rls=org.mozilla%3Apl%3Aofficial&channel=s&hl=pl&q=site%3Awww.ojejku.net&lr=&btnG=Szukaj+w+Google (http://www.google.com/search?client=firefox-a&rls=org.mozilla%3Apl%3Aofficial&channel=s&hl=pl&q=site%3Awww.ojejku.net&lr=&btnG=Szukaj+w+Google)

It indexes http://www.ojejku.net/img<img_id>.htm .... how can i change this ?
I've installed MOD from page 14.

Oh, and theres some http://www.ojejku.net/img<img_id>.search.htm indexed too...
And this www.ojejku.net/search.htm?search_keywords=<keyword> :(

PLZ help!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: leoseo on May 21, 2007, 01:29:38 AM
Hello Acidgod,

Without the cat id, cat does not work but isn't it possible like;
{catname}-catid/{imgname}-imgid.html

which would look like

/muscle-cars-12/dodge-24.html

this would do as well. Is there a mod like this? :=)

Guys this will not work!!! Read some of the previews Post...  :roll:

01.02.2007 and 09.02.2007 i wrote:

Without the IDs the Script doesn't now which Cat or Img you mean....

Without the cat id and image id it will not work!
And modify it to get it work without the cat_id for 30$???

No way... (o:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: xox on May 24, 2007, 03:59:23 PM
new seo for 4images
http://www.4homepages.de/forum/index.php?topic=17598.0
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: nobita on June 22, 2007, 05:39:22 PM
http://www.wallpaper-pack.com <~~ success!!!!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: toydog on June 29, 2007, 04:17:39 AM
Although the friendly URL is displaying perfectly in the browser but did anyone notice that when you use any sitemap tool to generate the sitemap, it returns something like that:

http://www.example.com/./cat1.html
http://www.example.com/./wallpaper1.html
http://www.example.com/././cat2.html
http://www.example.com/././wallpaper2.html

The /./ is increasing in the URL when more entries are generated. I have tried a few online free tool to confirm and the result are the same. So I believe it's something to do with the script/mod etc.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: kowalski on September 01, 2007, 08:09:20 AM
Is the URL structure that leoseo mentions possible with 4images?

{catname}-catid/{imgname}-imgid.html

/muscle-cars-12/dodge-24.html

(or even better - in my opinion - the same URL without .html on the end)


If I can solve my problems with the URL structure I am then ready to use 4images on my live site :)


Without the cat id, cat does not work but isn't it possible like;
{catname}-catid/{imgname}-imgid.html

which would look like

/muscle-cars-12/dodge-24.html

this would do as well. Is there a mod like this? :=)

Guys this will not work!!! Read some of the previews Post...  :roll:

01.02.2007 and 09.02.2007 i wrote:

Without the IDs the Script doesn't now which Cat or Img you mean....

Without the cat id and image id it will not work!
And modify it to get it work without the cat_id for 30$???

No way... (o:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: kowalski on September 01, 2007, 08:11:28 AM
also, has anyone been able to solve the problem of the category drop-down form?

If I install this mod, my category drop-down no longer works :(
It just redirects to www.mysite.com/cat.htm
whatever option I choose on the dropdown

I searched through the 27 pages but didn't see a solution
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: darvid on September 05, 2007, 03:04:58 PM
there is another seo mod, which works http://www.4homepages.de/forum/index.php?topic=17598.0
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: kowalski on September 05, 2007, 09:30:55 PM
there is another seo mod, which works http://www.4homepages.de/forum/index.php?topic=17598.0

I've already tried out that MOD c-bass.
It looks good, but I don't have the right skills to manipulate the URL the way I want it - please take a look at page5 on that thread (http://www.4homepages.de/forum/index.php?topic=17598.60) for my request/problem :)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: shilow on September 07, 2007, 03:34:17 AM
Is the Mod you are discussing here a program I can down load? If si, where? Or is it just code to install yourself.
Thanx :roll:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: knsin0 on September 14, 2007, 12:13:56 PM
Installed the kief24 modification: http://www.4homepages.de/forum/index.php?topic=6729.msg57268#msg57268
 and seems to work perfectly, category links work great but when i click con an image thumbnail i go to the index page an nothing happen, im using the same keyword for both, categories and details page so the generated links are:

category: domain.tld/keyword-catname-id.htm
image: domain.tld/keyword-imagename-id.htm

Could be this the problem? If it is, how can y fix it?
Thanks  8O
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: knsin0 on September 15, 2007, 12:15:56 AM
ok, found the problem, you cant use the same keyword for categories and detail pages,  :arrow: :wink:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Martin2006-B-2 on September 22, 2007, 03:50:26 PM
Sorry i found the answer on page 2...

-------------------------------
Hi i installed the "[Mod] Search Engine Friendly URLs aka Short URLs "  -  it works and i have a question... is it possible to make the URL's like " yourhomepage.com/?template=faq or yourhomepage.com/index.php?template=faq" also search engine friendly? (url is only an example)

THX for answers! Greetz
-------------------------------

QUESTION ANSWERED!!!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: artmedia on October 27, 2007, 10:59:20 PM
I was wondering if anyone had an idea how to implement keyword specifil urls?  While catagory2.htm\product3.htm helps the search engines spider the site it doesnt take SEO into mind.  Keyword spedific urls while not proven, have been clearly noted as having a SE advantage.  www.widgets.com/bluewidgets/trianglewidget.htm statistacally will get better PR than say www.widgets.com/prodx.htm

anyone know to implement that in the code?

there is something for you, try to create or install your gallery inside a folder with keywords name. Example: www.yourdomain.com/widgets/
then replace "img" or "cat" in your htacces and sessions.php for other keywords, then you will get url like mine:
http://www.ticas.co.cr/fotos_de_chicas/modelos_750.htm (i have replaced "img" for "modelos_" in both files)
 
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Julz on October 28, 2007, 09:53:26 AM
Hey dar!

I Need some help please..

Ive installed your mod for short urls http://www.4homepages.de/forum/index.php?topic=6729.msg57268#msg57268 (http://www.4homepages.de/forum/index.php?topic=6729.msg57268#msg57268)

It works fine, and ive also installed Google Sitemap:http://www.4homepages.de/forum/index.php?topic=15687.0 (http://www.4homepages.de/forum/index.php?topic=15687.0)

Now i'd like to know how i can have the same urls in my sitemap as my gallery?

Hope you cna help me :wink:

Julz
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: sammas on December 04, 2007, 09:31:19 PM
Hello
I know the next

How to convert to and from the links

member.php?action=showprofile&user_id=1 convert mamber-1.html

search.html?search_keywords=kids convert search-kids.html

search.html?search_new_images=1 convert new-images.html

cat4.html?page=2 convert cat4-2.html

search.html?show_result=1&page=2 convert search-2.html

and And

add title keyword to searching Add title keyword to searching Taitl title with the addition of each search and keywords

Note I can work foodstuffs Reiter, but I do not know how to work the file
sessions.php
And how addendum inside.

Therefore I need explanation Thank
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: sammas on December 06, 2007, 08:45:09 AM
please help me
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: ClickyMouse on December 06, 2007, 05:38:39 PM
Can this MOD be used without .htaccess? Because my server don't allow it... :(
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: sammas on December 06, 2007, 08:43:02 PM
??
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: sammas on December 07, 2007, 04:53:28 PM
waiting ....
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Nicky on December 07, 2007, 10:23:26 PM
sammas my brother :)

seams there is no1 who can help.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: sammas on December 08, 2007, 03:47:06 PM
Nicky my friend sorry :mrgreen:

how can help me
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: jojomart on December 09, 2007, 01:42:09 AM
I don't know what I've done wrong, if anything, but when I click on one of the pictures in my gallery, I get a 404 error instead of the right page - The url looks right, but it can't find the page:

http://www.wannaberichtoo.com/wallpaper/r-nature-1-35-below-kenai-alaska-35.htm (http://www.wannaberichtoo.com/wallpaper/r-nature-1-35-below-kenai-alaska-35.htm)

Here is the code for my .htaccess file:

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

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

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}

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

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

# End search engine friendly links code

I'm at a loss, please help me,

Joanne
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: beach-baer on December 21, 2007, 08:30:21 PM
Moin Moin!

Da meine Englischkenntnisse leider nahezu unbrauchbar sind, versuche ich das hier einmal auf deutsch. :roll:

Ich nutze diesen Mod schon seit Monaten ohne Probleme. Am Montag hat mein Provider ein Betriebssystemwechsel auf Debian durchgefhrt und prompt gibt es Schwierigkeiten. Wenn ich die Seite zum ersten Mal, frisch im neuen Browserfenster aufrufe und dann auf die Galerieseite gehe, haben alle URLs  wieder eine Session-ID. Ich vermute, dass das Problem in der Index.php liegt. Erst nach dem zweiten Durchlauf der Index.php tauchen die Session-IDs nicht mehr auf.

Da mein Provider auch keine Lsung parat hat, baue ich auf die Kompetenz dieses Forums. Kennt einer das Problem...?

Ganz doll dankbar fr eine Lsung  :D

Kay
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: tirakle on January 04, 2008, 02:31:52 PM
Hallo,

ich habe das gleiche Problem. Jedoch seit Anfang an. Wenn man die Gallery zum ersten Mal aufruft, haben alle URLs eine Session-ID. Wenn man weiterklickt, dann geht diese weg. Habe nun alles x-mal neu installiert und ausprobiert. Jedoch ohne Erfolg. Hat jemand eine Idee an was es liegen kann bzw. kann mir jemand seine htaccess + sessions.php, die 100% funktioniert zur Verfgung stellen ? Wre noch einen Versuch wert.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: beach-baer on January 04, 2008, 02:43:32 PM
Moin Moin!

Hier ist die Lsung: http://www.entwickler-blog.de/archiv/251-Session-ID-nicht-in-der-URL-sondern-nur-im-Cookie-speichern.html
 (http://www.entwickler-blog.de/archiv/251-Session-ID-nicht-in-der-URL-sondern-nur-im-Cookie-speichern.html)

Du brauchts dafr eine eigene separate php.ini, in der "session.use_trans_sid" auf off gestellt werden muss. Das musst Du mit deinem Provider klren. Bei hat sich das Problem damit auf jeden Fall erledigt gehabt.

Viel Glck und viele Gre aus Hamburg

Kay

P.S. Und auch ein "Frohes Neues" an alle hier  :)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: ClickyMouse on January 30, 2008, 08:44:53 PM
It is possible to have this Mod without the .htaccess file?

Because my Server don't allow it...

Thanks!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: maineyak on February 21, 2008, 03:12:34 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

For one thing, You cannot even access the upload button until you're logged in, which google can't do. Furthermore, it's no big deal about rewriting search url's either, as Google cannot search.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: maineyak on March 03, 2008, 04:55:24 AM
I have found one problem with this, I'm hoping someone can help. When I go to lightbox and click an image, the image url is now http://www.domain.com/image222.lightbox.htm, whereas everyewhere else on my site, the image is http://www.domain.com/tattoo-designs-web-face-222.htm.

How can I get it to show correctly like the rest of my site?

Djith and me ordered this mod, to put image name and category name in url.
After testing and debugging, we think it is ok now, and we are happy to share it with you.


This mod puts the names of the categories and the images in the url like this :
for image --->http://www.your-site.com/img-imagename-andnumber.htm
category --->http://www.your-site.com/cat-categoryname-andnumber.htm

you can see it working on http://www.edupics.com (1.7) and http://www.avatarcorner.com (1.7.1)
on these sites the "img" and "cat" in the url were changed to some keywords.
( see http://www.4homepages.de/forum/index.php?topic=6729.msg41243#msg41243 )


there is also the possibility to make url's with full path to image and categories : ( see //comment in mod )
for image --->http://www.your-site.com/img-full path to image.htm
category --->http://www.your-site.com/cat-full path of category.htm
This was not tested on our sites.


Don't forget to backup your files before editing !

files to be edited :
.htaccess
includes/sessions.php

Code: [Select]
 
=================================================
1. at the end of .htaccess, add following code :
=================================================
#Mod_bmollet : category name in URL
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}

#Mod_bmollet : This is to make search function work  ( redirect links from search results )
RewriteRule ^img([0-9]+).search.htm details.php?image_id=$1&%{QUERY_STRING}

=======================================================================

=========================================
2. add this code to include/sessions.php
=========================================
//Mod_bmollet
/**
 * Get the category url
 * @param int $cat_id The id of the category
 * @param string $cat_url The current status of the URL
 */
function get_category_url($cat_id,$cat_url = '')
{
global $site_db;
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['cat_name'] = strtr($row['cat_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$cat_url  = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
 * Get the image url
 * @param int $image_id The id of the image
 */
function get_image_url($image_id)
{
global $site_db;
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['image_name'] = strtr($row['image_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
// if you want comlpete path to image in url, remove comment from following line
//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}
========================================================================

========================================================================
3. In include/sessions.php replace function url(...) by following code.
========================================================================
/* ORIGINAL CODE
  function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }
*/
  function url($url, $amp = "&amp;") {
    global $l, $user_info;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];
    $url = str_replace('&amp;', '&', $url);
    if (!defined('IN_CP')) {
      if (strstr($url, 'index.php')) {
        $url = str_replace('index.php', '', $url);
      }
      elseif (strstr($url, 'search.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('search.php', 'search.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('search.php', 'search.htm', $url);
        }
      }
      elseif (strstr($url, 'lightbox.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('lightbox.php', 'lightbox.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
                $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('lightbox.php', 'lightbox.htm', $url);
        }
      }
      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];
            $cat_url = get_category_url($matches[1]);
            $url   = str_replace('categories.php', 'cat'.$cat_url.'.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);
        }
      }
      elseif (strstr($url, 'details.php?image_id=')) {
        if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
          preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
          if (isset($matches1[1]) && isset($matches2[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php', 'img'.$matches1[1].'.'.$matches2[1].'.htm', $url);
            $query = str_replace('image_id='.$matches1[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches1[1], '', $query);
            $query = str_replace('image_id='.$matches1[1], '', $query);
            $query = str_replace('mode='.$matches2[1].'&', '', $query);
            $query = str_replace('&mode='.$matches2[1], '', $query);
            $query = str_replace('mode='.$matches2[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php', 'img'.get_image_url($matches[1]).'.htm', $url);
            $query = str_replace('image_id='.$matches[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches[1], '', $query);
            $query = str_replace('image_id='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
      }
      elseif (strstr($url, 'postcards.php?image_id=')) {
        preg_match('#image_id=([0-9]+)&?#', $url, $matches);
        if (isset($matches[1])) {
          $split = explode('?', $url);
          $url = $split[0];
          $query = @$split[1];
          $url   = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
          $query = str_replace('image_id='.$matches[1].'&', '', $query);
          $query = str_replace('&image_id='.$matches[1], '', $query);
          $query = str_replace('image_id='.$matches[1], '', $query);
          if (!empty($query)) {
            $url .= '?' . $query;
          }
        }
      }
    }
    if ($this->mode == "get" && strstr($url, $this->session_id)) {
      $url .= strpos($url, '?') !== false ? '&' : '?';
      $url .= SESSION_NAME."=".$this->session_id;
    }
    if (!empty($l)) {
      $url .= strpos($url, '?') ? '&' : '?';
      $url .= "l=".$l;
    }
    $url = str_replace('&', $amp, $url);
    $url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
    return $url;
  }
========================================================================


========================================================================
4. In include/sessions.php following functions are useful for URL's like
   yoursite.com/maincategory/subcategory/imagename.htm
   
   This is not necessairy if you want url's (like we used on our sites) like this :
   for image --->http://www.your-site.com/img-imagename-andnumber.htm
   category --->http://www.your-site.com/cat-categoryname-andnumber.htm
========================================================================
//Mod_bmollet
/**
 * Get the category id
 * @param array $path An array with the path of the category
 * @param int $parent_id The parent id of the first item in the $path
 */
function get_category_id($path,$parent_id = 0)
{
$cat_name = array_shift($path);
global $site_db;
$sql = "SELECT cat_id FROM ".CATEGORIES_TABLE." WHERE cat_parent_id = $parent_id AND cat_name = '".mysql_real_escape_string($cat_name)."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
if( count($path) != 0)
{
return get_category_id($path,$row['cat_id']);
}
else
{
return $row['cat_id'];
}
}
//Mod_bmollet
/**
 * Get the image id
 * @param array $path An array with the path of the image
 */
function get_image_id($path)
{
global $site_db;
$image_name = array_pop($path);
$cat_id = get_category_id($path);
$sql = "SELECT image_id FROM ".IMAGES_TABLE." WHERE image_name = '".mysql_real_escape_string($image_name)."' AND cat_id = $cat_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
return $row['image_id'];
}
========================================================================


Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: ProDez on March 04, 2008, 03:00:51 PM
Many Thanks. It works fine!
Danke, damit funktioniert meine Seite nun viel besser und
die urls lassen sich viel leichter feststellen...  :D

ProDez,
http://www.portavision.de/mediacenter/
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: olgaart on March 20, 2008, 10:57:03 AM
Anybody knows, if it works on 1und1 hosting? Tried to install and it did not work on my homepage http://www.fotoclub.robertmagel.de/
Many Tnx
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Suricata on March 29, 2008, 09:06:54 AM
Hallo,

ich musste den MOD wieder bei mir wieder entfernen, weil ich Fehler 404 bekomme, sobald ich die home.html verlasse.

Eine Lsung zu dem problem konnte ich leider hier nicht finden.

Viele Gre
Suricata
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sumale.my on April 01, 2008, 06:51:31 PM
geht das auch mit der 1.7.6 ?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: tiamo86 on April 16, 2008, 04:08:02 AM
okie
I read all post of this topic but it so confution
What correct the way to hack mod for seo friendly.
I want it like:
sitename.com/categories -> and title of page like :  Categories - <title of website>
sitename.com/categories/img-name.html -> and title of page like: img-name - <title of website>

i think it better for SEO.

The gallery source can do (http://gallery.menalto.com/) but is very slow, that i use 4images.

Please help.
Thanks all
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: knucklehead on April 18, 2008, 12:24:04 AM
Does this MOD work with v1.7.6?  I already tried the Google SEO mod with no success on 1.7.6.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: om6acw on April 18, 2008, 04:44:01 AM
Does this MOD work with v1.7.6?  I already tried the Google SEO mod with no success on 1.7.6.

yes, works pretty good (http://www.myanimalsworld.com (http://www.myanimalsworld.com))
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: knucklehead on April 19, 2008, 04:54:25 AM
Does this MOD work with v1.7.6?  I already tried the Google SEO mod with no success on 1.7.6.

yes, works pretty good (http://www.myanimalsword.com (http://www.myanimalsword.com))

Nice, thanks allot for the reply om6acw!!  I'll try installing when I get back home.  I'll post a link if I'm successful.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: rodier on April 23, 2008, 05:19:39 AM
I want ask if you plan make it  little more "seo" :-)  there is another "seo" mod that make url long but readable by people..   
the problem is,  only your seo mod support  another mod here that will make sitemap.xml for google

+ im asking.. what is better.   these short anonymous url + sitemap 
or  long human readible  without sitemap ?  (for google)?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Mx Man on August 07, 2008, 03:29:34 PM
Hi all
Please help
I want to shorten this link:
http://sitename.com/search.htm?search_keywords=pic

To:
http://sitename.com/search-pic.htm

How can I do that
Thanks
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sumale.my on October 25, 2008, 04:35:07 PM
Hello,

i have the Gallery 1.7.6. But this Mod dont work with 1.7.6.

I Searched the Code from Step 1 in Sessions.php

The Searched Code is:


  function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }

But my Code is:

  function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && strpos($url, $this->session_id) === false) {
      $url .= strpos($url, '?') !== false ? $amp : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= strpos($url, '?') !== false ? $amp : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }

I did it then test done


  /*
  function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && strpos($url, $this->session_id) === false) {
      $url .= strpos($url, '?') !== false ? $amp : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= strpos($url, '?') !== false ? $amp : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }*/
  function url($url, $amp = "&amp;") {
    global $l, $user_info;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];
    $url = str_replace('&amp;', '&', $url);
    if (!defined('IN_CP')) {
      if (strstr($url, 'index.php')) {
        $url = str_replace('index.php', './', $url);
      }
      elseif (strstr($url, 'search.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('search.php', 'search.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('search.php', 'search.htm', $url);
        }
      }
      elseif (strstr($url, 'lightbox.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('lightbox.php', 'lightbox.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
                $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('lightbox.php', 'lightbox.htm', $url);
        }
      }
      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);
        }
      }
      elseif (strstr($url, 'details.php?image_id=')) {
        if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
          preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
          if (isset($matches1[1]) && isset($matches2[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php', 'img'.$matches1[1].'.'.$matches2[1].'.htm', $url);
            $query = str_replace('image_id='.$matches1[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches1[1], '', $query);
            $query = str_replace('image_id='.$matches1[1], '', $query);
            $query = str_replace('mode='.$matches2[1].'&', '', $query);
            $query = str_replace('&mode='.$matches2[1], '', $query);
            $query = str_replace('mode='.$matches2[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php', 'img'.$matches[1].'.htm', $url);
            $query = str_replace('image_id='.$matches[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches[1], '', $query);
            $query = str_replace('image_id='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
      }
      elseif (strstr($url, 'postcards.php?image_id=')) {
        preg_match('#image_id=([0-9]+)&?#', $url, $matches);
        if (isset($matches[1])) {
          $split = explode('?', $url);
          $url = $split[0];
          $query = @$split[1];
          $url   = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
          $query = str_replace('image_id='.$matches[1].'&', '', $query);
          $query = str_replace('&image_id='.$matches[1], '', $query);
          $query = str_replace('image_id='.$matches[1], '', $query);
          if (!empty($query)) {
            $url .= '?' . $query;
          }
        }
      }
    }
    if ($this->mode == "get" && strstr($url, $this->session_id)) {
      $url .= strpos($url, '?') !== false ? '&' : '?';
      $url .= SESSION_NAME."=".$this->session_id;
    }
    if (!empty($l)) {
      $url .= strpos($url, '?') ? '&' : '?';
      $url .= "l=".$l;
    }
    $url = str_replace('&', $amp, $url);
    $url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
    return $url;
  }

   
Then I created the htaccess!
With this Code:

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

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

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}

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

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

# End search engine friendly links code

But now I can on my site no longer accessible!
This Error:
Quote
   
Server Error!

The request can not be answered because an internal server error. The server is either overloaded or an error in a CGI script has occurred.

Unless you consider it a malfunction of the server hold, please inform the Webmaster.

Then I made, as described with the PIX!

#RewriteBase /

Replace with:
RewriteBase /pix/

But dont work!!!

My Complete session.php is current without the code:
please attach the files to the post. Forum's database space is not unlimited

My Session.php with the code:
please attach the files to the post. Forum's database space is not unlimited
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 25, 2008, 08:29:45 PM
Are you sure your server supports mod_rewrite? restore original sessions.php and see if site works with code in .htaccess.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sumale.my on October 25, 2008, 11:31:37 PM
Hello,

The mod_rewrite works on my server, but not in xammp! I now have my site on my server load and to the extent it works well, but the categories are no longer open.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 25, 2008, 11:45:42 PM
try this code instead:
Code: [Select]
# Begin search engine friendly links code
RewriteEngine On
#RewriteBase /
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}

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

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

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

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

# End search engine friendly links code
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sumale.my on October 26, 2008, 12:19:54 AM
WOW!

Thank you very much my friend!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sumale.my on October 26, 2008, 03:10:07 AM
Hello,

I now have a bit of testing and some other links with mod_rewrite changed such as: contact.html and so forth. But a setting is not accepted it with the self-created templates to be done.

Here again what I did.

---

Hallo zusammen,

ich habe nun ein wenig getestet und einige weitere Links mit mod_rewrite gendert wie zum Beispiel: contact.html und so weiter. Aber eine Einstellung wird nicht bernommen es hat mit den selbst erstellten templates zu tun.

Hier einmal was ich gemacht habe.

Im Open: includes/session.php
Search:
elseif (strstr($url, 'lightbox.php')) {
add before:
      elseif (strstr($url, 'index.php?template=about_us')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('index.php?template=about_us', 'aboutus.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
                $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('index.php?template=about_us', 'aboutus.htm', $url);
        }
      }

Im Open .htaccess
Search:
Code: [Select]
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}add after:
Code: [Select]
RewriteRule ^aboutus\.htm$ index.php?template=about_us?%{QUERY_STRING}
RewriteRule ^aboutus\.([0-9]+)\.htm$ index.php?template=about_us?page=$1&%{QUERY_STRING}

But that does not work. There must be something else?
The works here but also that runs at me:
-----
Aber das klappt nicht. Muss da etwas anders eingestellt werden?
Das hier klappt aber auch, dass luft bei mir:

Code: [Select]
RewriteRule ^kontaktformular\.htm$ support.php?action=newticket?%{QUERY_STRING}
RewriteRule ^kontaktformular\.([0-9]+)\.htm$ support.php?action=newticket?page=$1&%{QUERY_STRING}

and

      elseif (strstr($url, 'support.php?action=newticket')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('support.php?action=newticket', 'kontaktformular.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
                $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('support.php?action=newticket', 'kontaktformular.htm', $url);
        }
      }

That goes without problems, but that with "index.php? Template =" this is not.
---
Das klappt ohne Probleme, aber das mit "index.php?template=" das geht nicht.

   
I also wish that from index.php, will start.htm. Can this be accomplished?
---
Ich mchte auch, dass aus index.php, start.htm wird. Kann man das bewerkstelligen?

[EDIT by V@no]
Don't use [php][/php] tags for non-PHP code, it doesn't display correctly.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: om6acw on October 26, 2008, 04:13:58 AM
This is not working for you ???

Code: [Select]
RewriteRule ^([a-zA-Z0-9_-]+)\.html$ index.php?template=$1&%{QUERY_STRING}
works for me ;)

Hello, ..............................................................................
That goes without problems, but that with "index.php? Template =" this is not.
---
Das klappt ohne Probleme, aber das mit "index.php?template=" das geht nicht.

   
I also wish that from index.php, will start.htm. Can this be accomplished?
---
Ich mchte auch, dass aus index.php, start.htm wird. Kann man das bewerkstelligen?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sumale.my on October 26, 2008, 04:24:22 AM
Hy,

I would also be grateful to you if you'd say what you've done! For me it works absolutely not!

The following is my Session.php:


      elseif (strstr($url, 'index.php?template=about_us')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('index.php?template=about_us', 'aboutus.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
                $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('index.php?template=about_us', 'aboutus.htm', $url);
        }
      }

The following is my .htaccess:

RewriteRule ^aboutus\.htm$ index.php?template=about_us?%{QUERY_STRING}
RewriteRule ^([a-zA-Z0-9_-]+)\.html$ index.php?template=$1&%{QUERY_STRING}

But dont work :(

I must be different then the link? Would be nice if you step could explain!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: om6acw on October 26, 2008, 04:40:00 AM
I didnt make any changes in session.php I just put above code into my .htaccess file and
I'm calling my contact.php file from menu this way

Code: [Select]
href="./contact.htm"

before I have to call that file this way

Code: [Select]
href="./contact.php"
and about_us.html like this

Code: [Select]
href="./index.php?template=about_us"
Only changes in session.php what I did are for categories, details, guestbook, top and search, that's all.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sumale.my on October 26, 2008, 04:45:03 AM
Hey,

PHP individual files so call to leave is so easy, but somehow this does not work with my code.

Really, I do not understand how you think! Show times but ask the entire code of the piece.

Because I check what is absolutely not, sorry!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 26, 2008, 04:48:00 AM
This is not working for you ???

Code: [Select]
RewriteRule ^([a-zA-Z0-9_-]+)\.html$ index.php?template=$1&%{QUERY_STRING}
works for me ;)
that would only work if you place it at the end of .htaccess

@Phisker B:
Please don't use [php][/php] tags for non-PHP code, it doesn't display correctly:
Code: [Select]
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}same code but displays different (no backslashes):
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: om6acw on October 26, 2008, 04:51:55 AM
Hey,

PHP individual files so call to leave is so easy, but somehow this does not work with my code.

Really, I do not understand how you think! Show times but ask the entire code of the piece.

Because I check what is absolutely not, sorry!

If I understand you right, you want to see your about_us when you call this file from your menu like about_us.htm
Just delete this from session.php

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

and this from .htaccess

Code: [Select]
RewriteRule ^aboutus.htm$ index.php?template=about_us?%{QUERY_STRING}
live this line in at the end of .htaccess

Code: [Select]
RewriteRule ^([a-zA-Z0-9_-]+).html$ index.php?template=$1&%{QUERY_STRING}
and change your link in menu template to about_us file to this

Code: [Select]
href="./about_us.html"
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: om6acw on October 26, 2008, 04:53:15 AM
This is not working for you ???

Code: [Select]
RewriteRule ^([a-zA-Z0-9_-]+)\.html$ index.php?template=$1&%{QUERY_STRING}
works for me ;)
that would only work if you place it at the end of .htaccess

@Phisker B:
Please don't use [php][/php] tags for non-PHP code, it doesn't display correctly:
Code: [Select]
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}same code but displays different (no backslashes):
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}

That's right V@no I forgot to mention that ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sumale.my on October 26, 2008, 05:08:31 AM
@ V@no,
okay, sorry!

@ om6acw
Now I have understood this.
But that does not work!

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

RewriteRule ^kontaktformular\.htm$ support.php?action=newticket?%{QUERY_STRING}
RewriteRule ^kontaktformular\.([0-9]+)\.htm$ support.php?action=newticket?page=$1&%{QUERY_STRING}

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

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

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

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

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

# End search engine friendly links code

RewriteRule ^([a-zA-Z0-9_-]+)\.html$ index.php?template=$1&%{QUERY_STRING}

This is my link:
[code]<a href="./aboutus.htm">About us</a>

Code: [Select]
This error message appears:
  The requested URL on the server could not be found. The link on the referring page seems incorrect or no longer relevant to be. Please inform the author of this page about the error.

Unless you consider it a malfunction of the server hold, please inform the Webmaster.
[/code]
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: om6acw on October 26, 2008, 05:27:38 AM
do you have your aboutus.html in your template folder???
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 26, 2008, 05:48:34 AM
actually, the problem is that in the link you have aboutus.htm but in .htaccess you have:
RewriteRule ^([a-zA-Z0-9_-]+)\.html$ index.php?template=$1&%{QUERY_STRING}

aboutus.html would work
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sumale.my on October 26, 2008, 02:40:03 PM
Ahahaha,

Vano, you're absolutely right! Then I would ourselves can!
But still many thanks to you both!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sumale.my on October 26, 2008, 08:10:48 PM
I also wish that from index.php, will start.htm. Can this be accomplished?
If I so Adjusters, then I get an error:
---
Ich mchte auch, dass aus index.php, start.htm wird. Kann man das bewerkstelligen?
Wenn ich das so einstelle, dann bekomme ich ein Fehler:

Code: [Select]
Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in C:\xampp\htdocs\2\includes\sessions.php on line 617
The Code on the line 617 ist:
--
Der Code in der Zeile 617 ist:

define('COOKIE_NAME', '4images_');

My Code for the session.php:
--
Mein Code fr die session.php


      elseif (strstr($url, 'index.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('index.php', 'startseite.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
                $url .= '?' . $query;
            }
          }
        }


And .htaccess
--
Und .htaccess

Code: [Select]
RewriteRule ^startseite\.htm$ index.php?%{QUERY_STRING}
RewriteRule ^startseite\.([0-9]+)\.htm$ index.php?page=$1&%{QUERY_STRING}

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sumale.my on October 26, 2008, 08:56:42 PM
   
Oh,

sorry! That is the code for me, so I have my extra file attached packed.

Nevertheless, this does not work!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 26, 2008, 10:04:39 PM
Add }
above:
elseif (strstr($url, 'index.php')) {
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sumale.my on October 27, 2008, 07:56:22 AM
   
That is present or not?
That is the code in my Session.php is registered
That is my code:


  /*
  function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && strpos($url, $this->session_id) === false) {
      $url .= strpos($url, '?') !== false ? $amp : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= strpos($url, '?') !== false ? $amp : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }*/
  function url($url, $amp = "&amp;") {
    global $l, $user_info;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];
    $url = str_replace('&amp;', '&', $url);
    if (!defined('IN_CP')) {
      if (strstr($url, 'index.php')) {
        $url = str_replace('index.php', './', $url);
      }
      elseif (strstr($url, 'search.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('search.php', 'search.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('search.php', 'search.htm', $url);
        }
      }
      elseif (strstr($url, 'support.php?action=newticket')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('support.php?action=newticket', 'kontaktformular.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
                $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('support.php?action=newticket', 'kontaktformular.htm', $url);
        }
      }
      elseif (strstr($url, 'index.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('index.php', 'startseite.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
                $url .= '?' . $query;
            }
          }
        }

        else {
          $url = str_replace('index.php', 'startseite.htm', $url);
        }
      }

      elseif (strstr($url, 'lightbox.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('lightbox.php', 'lightbox.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
                $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('lightbox.php', 'lightbox.htm', $url);
        }
      }
      elseif (strstr($url, 'memberlist.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('memberlist.php', 'mitglieder.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
                $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('memberlist.php', 'mitglieder.htm', $url);
        }
      }
 
      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);
        }
      }
      elseif (strstr($url, 'details.php?image_id=')) {
        if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
          preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
          if (isset($matches1[1]) && isset($matches2[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php', 'produkt'.$matches1[1].'.'.$matches2[1].'.htm', $url);
            $query = str_replace('image_id='.$matches1[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches1[1], '', $query);
            $query = str_replace('image_id='.$matches1[1], '', $query);
            $query = str_replace('mode='.$matches2[1].'&', '', $query);
            $query = str_replace('&mode='.$matches2[1], '', $query);
            $query = str_replace('mode='.$matches2[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php', 'produkt'.$matches[1].'.htm', $url);
            $query = str_replace('image_id='.$matches[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches[1], '', $query);
            $query = str_replace('image_id='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
      }
      elseif (strstr($url, 'postcards.php?image_id=')) {
        preg_match('#image_id=([0-9]+)&?#', $url, $matches);
        if (isset($matches[1])) {
          $split = explode('?', $url);
          $url = $split[0];
          $query = @$split[1];
          $url   = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
          $query = str_replace('image_id='.$matches[1].'&', '', $query);
          $query = str_replace('&image_id='.$matches[1], '', $query);
          $query = str_replace('image_id='.$matches[1], '', $query);
          if (!empty($query)) {
            $url .= '?' . $query;
          }
        }
      }
    }
    if ($this->mode == "get" && strstr($url, $this->session_id)) {
      $url .= strpos($url, '?') !== false ? '&' : '?';
      $url .= SESSION_NAME."=".$this->session_id;
    }
    if (!empty($l)) {
      $url .= strpos($url, '?') ? '&' : '?';
      $url .= "l=".$l;
    }
    $url = str_replace('&', $amp, $url);
    $url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
    return $url;
  }
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on October 27, 2008, 08:00:14 AM
that bracket is missing in your code, add it.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sumale.my on October 27, 2008, 08:13:49 AM
Ok, thank you!
But just changed the mod to.
[MOD] Google Friendly Urls For 4images Best Seo Mod (http://www.4homepages.de/forum/index.php?topic=17598.0)

This here is better and looks beautiful! And it runs everything perfect!


Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: AKIN on November 05, 2008, 08:57:36 PM
hi all.
thanks nice mod.

but..

domain.com/categoryname/imagename.html  how to work?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: mixer on November 11, 2008, 07:57:23 PM
thanks chris ..

I have a problem ..

Has been transferred in full links ..

But when opening any pictures show this message :

Quote
Not Found

The requested URL /topics/img174.htm was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

What is the solution ?

Regards ..
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Nicky on November 11, 2008, 08:31:33 PM
hello and welcome to the 4images forum,

well, you did something wrong.

did you try already with
Code: [Select]
RewriteBase /topicsin .htaccess
or post your .htacces and maybe your here
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on November 12, 2008, 02:52:14 AM
and to add to Nicky's response:
- make sure mod_rewrite is installed and enabled on your server
- if you have access to the server's log files, look in there, it might provide more information about the error.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: nameless on November 19, 2008, 05:21:45 AM
Nice mod thank you

i read all replay

i make this mod and it's work ok but can i make

www.mysite.com/cat-category name-catID.html
www.mysite.com/img-img name-imgID.html

to
www.mysite.com/category name-cat-catID.html
www.mysite.com/img name-img-imgID.html

thanks agine
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: ashfaq on January 04, 2009, 04:16:59 PM
Will anyone please please tell me how to change image markers ?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: kandr on January 23, 2009, 01:17:01 PM
Как сделать страницы из вида article?id=1 в вид article1.htm? ТАк не получается?  :roll:

Code: [Select]
RewriteRule ^article\.htm$ article.php?%{QUERY_STRING}
RewriteRule ^article([0-9]*)$ article.php?id=$1&%{QUERY_STRING}

Code: [Select]
elseif (strstr($url, 'article.php'))
      {
        preg_match('#id=([0-9]+)&?#', $url, $matches);
        $url_id = "";
        if (isset($matches[1]))
        {
          $url_id = $matches[1];
        }
        $split = explode('?', $url);
        $url = $split[0];
        $query = @$split[1];
        $url   = str_replace('article.php', 'article'.$matches[1].'.htm', $url);
        $query = str_replace('id='.$url_id.'&', '', $query);
        $query = str_replace('&id='.$url_id, '', $query);
        $query = str_replace('id='.$url_id, '', $query);
       
        if (!empty($query)) {
            $url .= '?' . $query;
        }
        else {
          $url = str_replace('article.php', 'article.htm', $url);
         
        }
      }
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: AntiNSA2 on May 19, 2009, 06:35:18 AM
Ok, thank you!
But just changed the mod to.
[MOD] Google Friendly Urls For 4images Best Seo Mod (http://www.4homepages.de/forum/index.php?topic=17598.0)

This here is better and looks beautiful! And it runs everything perfect!



I have also installed this mod... maybe a stupid question... install them both together or do you have to chose one or the other?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: tramfahrer on May 21, 2009, 06:01:06 PM
geht das auch mit der Version 1.7.7

bei mir will das nicht laufen wollen
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sumale.my on May 27, 2009, 01:10:15 PM
Wie kann man denn den Profillink krzen?

Das dieser in etwas so aussieht:

Code: [Select]
member.php?action=showprofile&user_id=1
to

Code: [Select]
nickname/profile/
Geht das?


add1

in sessions.php
before
Code: [Select]
elseif (strstr($url, 'postcards.php?image_id=')) {
add
Code: [Select]
      elseif (strstr($url, 'member.php?action=showprofile&user_id=')) {
                preg_match('#user_id=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $url   = str_replace('member.php', 'profile'.$matches[1].'.htm', $url);
          }

return $url;
}
Now short urls for profiles works and looks like
Code: [Select]
http://localhost/4images/profile49

And now I planing to make them like
Code: [Select]
http://localhost/4images/nick/profilelater planing
Code: [Select]
http://localhost/4images/search.htm?search_user=nickchange in to
Code: [Select]
http://localhost/4images/nick/gallery
If someone could help...
[/quote]
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: AntiNSA2 on June 07, 2009, 05:26:55 PM
Ok, you said:

In 4images v1.7.6 the line you should find is:
Code: [Select]
    if ($this->mode == "get" && strpos($url, $this->session_id) === false) {
Replace it with:
Code: [Select]
    global $user_bot;
    if (!$user_bot && $this->mode == "get" && strpos($url, $this->session_id) === false) {

I dont have that in my sessions.php.... here is mine
Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: sessions.php                                         *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    * 
 *              Web: http://www.4homepages.de                             * 
 *    Scriptversion: 1.7.6                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) fr weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
if (!defined('ROOT_PATH')) {
  die(
"Security violation");
}
/*
  MOD VISITORS COUNTRY FLAGS
  START INSERT
*/
    
if (!class_exists("GeoIP"))
    {
      include(
ROOT_PATH."includes/geoip.inc");
    }
    
    
$gi geoip_open(ROOT_PATH."includes/GeoIP.dat",GEOIP_STANDARD);
    
$countries = array();
/*
  MOD VISITORS COUNTRY FLAGS
  END INSERT
*/
//-----------------------------------------------------
//--- Start Configuration -----------------------------
//-----------------------------------------------------

define('SESSION_NAME''sessionid');

$user_table_fields = array(
  
"user_id" => "user_id",
  
"user_level" => "user_level",
  
"user_name" => "user_name",
  
"user_password" => "user_password",
  
"user_email" => "user_email",
  
"user_showemail" => "user_showemail",
  
"user_allowemails" => "user_allowemails",
  
"user_invisible" => "user_invisible",
  
"user_joindate" => "user_joindate",
  
"user_activationkey" => "user_activationkey",
  
"user_lastaction" => "user_lastaction",
  
"user_location" => "user_location",
  
"user_lastvisit" => "user_lastvisit",
  
"user_comments" => "user_comments",
  
"user_homepage" => "user_homepage",
  
"user_icq" => "user_icq"
);

//-----------------------------------------------------
//--- End Configuration -------------------------------
//-----------------------------------------------------

function get_user_table_field($add$user_field) {
  global 
$user_table_fields;
  return (!empty(
$user_table_fields[$user_field])) ? $add.$user_table_fields[$user_field] : "";
}

class 
Session {

  var 
$session_id;
  var 
$session_key;
  var 
$user_ip;
  var 
$user_location;
  var 
$current_time;
  var 
$session_timeout;
  var 
$mode "get";
  var 
$session_info = array();
  var 
$user_info = array();

  function 
Session() {
    global 
$config;
    
$this->session_timeout $config['session_timeout'] * 60;
    
$this->user_ip $this->get_user_ip();
    
$this->user_location $this->get_user_location();
    
$this->current_time time();

    if (
defined('SESSION_KEY') && SESSION_KEY != '') {
        
$this->session_key SESSION_KEY;
    } else {
        
$this->session_key md5('4images' realpath(ROOT_PATH));
    }

    
// Stop adding SID to URLs
    
@ini_set('session.use_trans_sid'0);

    
//@ini_set('session.cookie_lifetime', $this->session_timeout);

    
session_name(urlencode(SESSION_NAME));
    @
session_start();

    
$this->demand_session();
  }

  function 
set_cookie_data($name$value$permanent 1) {
    
$cookie_expire = ($permanent) ? $this->current_time 60 60 24 365 0;
    
$cookie_name COOKIE_NAME.$name;
    
setcookie($cookie_name$value$cookie_expireCOOKIE_PATHCOOKIE_DOMAINCOOKIE_SECURE);
    
$HTTP_COOKIE_VARS[$cookie_name] = $value;
  }

  function 
read_cookie_data($name) {
    global 
$HTTP_COOKIE_VARS;
    
$cookie_name COOKIE_NAME.$name;
    return (isset(
$HTTP_COOKIE_VARS[$cookie_name])) ? $HTTP_COOKIE_VARS[$cookie_name] : false;
  }

  function 
get_session_id() {
    if (
SID == '') {
      
$this->mode "cookie";
    }

    if (
preg_match('/[^a-z0-9]+/i'session_id())) {
      @
session_regenerate_id();
    }

    
$this->session_id session_id();
  }

  function 
demand_session() {
    
$this->get_session_id();
    if (!
$this->load_session_info()) {
      
$this->delete_old_sessions();
      
$user_id = ($this->read_cookie_data("userid")) ? intval($this->read_cookie_data("userid")) : GUEST;
      
$this->start_session($user_id);
    }
    else {
      
$this->user_info $this->load_user_info($this->session_info['session_user_id']);
      
$update_cutoff = ($this->user_info['user_id'] != GUEST) ? $this->current_time $this->user_info['user_lastaction'] : $this->current_time $this->session_info['session_lastaction'];
      if (
$update_cutoff 60) {
        
$this->update_session();
        
$this->delete_old_sessions();
      }
    }
  }

  function 
start_session($user_id GUEST$login_process 0) {
    global 
$site_db;

    
$this->user_info $this->load_user_info($user_id);
    if (
$this->user_info['user_id'] != GUEST && !$login_process) {
      if (
$this->read_cookie_data("userpass") == $this->user_info['user_password'] && $this->user_info['user_level'] > USER_AWAITING) {
        
$this->set_cookie_data("userpass"$this->user_info['user_password']);
      }
      else {
        
$this->set_cookie_data("userpass"""0);
        
$this->user_info $this->load_user_info(GUEST);
      }
    }

    
//if (!$login_process) {
      
$sql "REPLACE INTO ".SESSIONS_TABLE."
              (session_id, session_user_id, session_lastaction, session_location, session_ip)
              VALUES
              ('"
.addslashes($this->session_id)."', ".$this->user_info['user_id'].", $this->current_time, '$this->user_location', '$this->user_ip')";
      
$site_db->query($sql);
    
//}

    
$this->session_info['session_user_id'] = $this->user_info['user_id'];
    
$this->session_info['session_lastaction'] = $this->current_time;
    
$this->session_info['session_location'] = $this->user_location;
    
$this->session_info['session_ip'] = $this->user_ip;

    if (
$this->user_info['user_id'] != GUEST) {
      
$this->user_info['user_lastvisit'] = (!empty($this->user_info['user_lastaction'])) ? $this->user_info['user_lastaction'] : $this->current_time;
      
$sql "UPDATE ".USERS_TABLE."
              SET "
.get_user_table_field("""user_lastaction")." = $this->current_time, ".get_user_table_field("""user_location")." = '$this->user_location', ".get_user_table_field("""user_lastvisit")." = ".$this->user_info['user_lastvisit']."
              WHERE "
.get_user_table_field("""user_id")." = ".$this->user_info['user_id'];
      
$site_db->query($sql);
    }
    
$this->set_cookie_data("lastvisit"$this->user_info['user_lastvisit']);
    
$this->set_cookie_data("userid"$this->user_info['user_id']);
    return 
true;
  }

  function 
login($user_name ""$user_password ""$auto_login 0$set_auto_login 1$do_md5 true) {
    global 
$site_db$user_table_fields;

    if (empty(
$user_name) || empty($user_password)) {
      return 
false;
    }
    
$sql "SELECT ".get_user_table_field("""user_id").get_user_table_field(", ""user_password")."
            FROM "
.USERS_TABLE."
            WHERE "
.get_user_table_field("""user_name")." = '$user_name' AND ".get_user_table_field("""user_level")." <> ".USER_AWAITING;
    
$row $site_db->query_firstrow($sql);

    
$user_id = (isset($row[$user_table_fields['user_id']])) ? $row[$user_table_fields['user_id']] : GUEST;
    


if(
$do_md5 == true$user_password md5($user_password);
    if (
$user_id != GUEST) {
      if (
$row[$user_table_fields['user_password']] == $user_password) {
        
$sql "UPDATE ".SESSIONS_TABLE."
                SET session_user_id = 
$user_id
                WHERE session_id = '"
.addslashes($this->session_id)."'";
        
$site_db->query($sql);
        if (
$set_auto_login) {
          
$this->set_cookie_data("userpass", ($auto_login) ? $user_password "");
        }
        
$this->start_session($user_id1);
        return 
true;
      }
    }
    return 
false;
  }

  function 
logout($user_id) {
    global 
$site_db;
    
$sql "DELETE FROM ".SESSIONS_TABLE."
            WHERE session_id = '"
.addslashes($this->session_id)."' OR session_user_id = $user_id";
    
$site_db->query($sql);
    
$this->set_cookie_data("userpass"""0);
    
$this->set_cookie_data("userid"GUEST);

    
$this->session_info = array();

    return 
true;
  }

  function 
delete_old_sessions() {
    global 
$site_db;
    
$expiry_time $this->current_time $this->session_timeout;
    
$sql "DELETE FROM ".SESSIONS_TABLE."
            WHERE session_lastaction < 
$expiry_time";
    
$site_db->query($sql);

    return 
true;
  }

  function 
update_session() {
    global 
$site_db;

    
$sql "REPLACE INTO ".SESSIONS_TABLE."
           (session_id, session_user_id, session_lastaction, session_location, session_ip)
           VALUES
           ('"
.addslashes($this->session_id)."', ".$this->user_info['user_id'].", $this->current_time, '$this->user_location', '$this->user_ip')";
    
$site_db->query($sql);

    
$this->session_info['session_lastaction'] = $this->current_time;
    
$this->session_info['session_location'] = $this->user_location;
    
$this->session_info['session_ip'] = $this->user_ip;

    if (
$this->user_info['user_id'] != GUEST) {
      
$sql "UPDATE ".USERS_TABLE."
              SET "
.get_user_table_field("""user_lastaction")." = $this->current_time, ".get_user_table_field("""user_location")." = '$this->user_location'
              WHERE "
.get_user_table_field("""user_id")." = ".$this->user_info['user_id'];
      
$site_db->query($sql);
    }
    return;
  }

  function 
return_session_info() {
    return 
$this->session_info;
  }

  function 
return_user_info() {
    return 
$this->user_info;
  }

  function 
freeze() {
    return;
  }

  function 
load_session_info() {
    if (@
ini_get('register_globals')) {
      
session_register($this->session_key);

      if (!isset(
$GLOBALS[$this->session_key])) {
        
$GLOBALS[$this->session_key] = array();
      }

      
$this->session_info = &$GLOBALS[$this->session_key];

    } else {
      if (isset(
$_SESSION)) {
        if (!isset(
$_SESSION[$this->session_key])) {
          
$_SESSION[$this->session_key] = array();
        }

        
$this->session_info = &$_SESSION[$this->session_key];

      } else {
        if (!isset(
$GLOBALS['HTTP_SESSION_VARS'][$this->session_key])) {
          
$GLOBALS['HTTP_SESSION_VARS'][$this->session_key] = array();
        }

        
$this->session_info = &$GLOBALS['HTTP_SESSION_VARS'][$this->session_key];
      }
    }

    if (!isset(
$this->session_info['session_ip'])) {
      
$this->session_info = array();
      return 
false;
    }

    if (
$this->mode == "get" && $this->session_info['session_ip'] != $this->user_ip) {
      if (
function_exists('session_regenerate_id')) {
        @
session_regenerate_id();
      }
      
$this->get_session_id();
      
$this->session_info = array();
      return 
false;
    }

    return 
$this->session_info;
  }

  function 
load_user_info($user_id GUEST) {
    global 
$site_db$user_table_fields;

    if (
$user_id != GUEST) {
      
$sql "SELECT u.*, l.*
              FROM "
.USERS_TABLE." u, ".LIGHTBOXES_TABLE." l
              WHERE "
.get_user_table_field("u.""user_id")." = $user_id AND l.user_id = ".get_user_table_field("u.""user_id");
      
$user_info $site_db->query_firstrow($sql);
      if (!
$user_info) {
        
$sql "SELECT *
                FROM "
.USERS_TABLE."
                WHERE "
.get_user_table_field("""user_id")." = $user_id";
        
$user_info $site_db->query_firstrow($sql);
        if (
$user_info) {
          
$lightbox_id get_random_key(LIGHTBOXES_TABLE"lightbox_id");
          
$sql "INSERT INTO ".LIGHTBOXES_TABLE."
                  (lightbox_id, user_id, lightbox_lastaction, lightbox_image_ids)
                  VALUES
                  ('
$lightbox_id', ".$user_info[$user_table_fields['user_id']].", $this->current_time, '')";
          
$site_db->query($sql);
          
$user_info['lightbox_lastaction'] = $this->current_time;
          
$user_info['lightbox_image_ids'] = "";
        }
      }
    }
    if (empty(
$user_info[$user_table_fields['user_id']])) {
      
$user_info = array();
      
$user_info['user_id'] = GUEST;
      
$user_info['user_level'] = GUEST;
      
$user_info['user_lastaction'] = $this->current_time;
      
$user_info['user_lastvisit'] = ($this->read_cookie_data("lastvisit")) ? $this->read_cookie_data("lastvisit") : $this->current_time;
    }
    foreach (
$user_table_fields as $key => $val) {
      if (isset(
$user_info[$val])) {
        
$user_info[$key] = $user_info[$val];
      }
      elseif (!isset(
$user_info[$key])) {
        
$user_info[$key] = "";
      }
    }
    return 
$user_info;
  }

  function 
set_session_var($var_name$value) {
    
$this->session_info[$var_name] = $value;
    return 
true;
  }

  function 
get_session_var($var_name) {
    if (isset(
$this->session_info[$var_name])) {
      return 
$this->session_info[$var_name];
    }

    return 
'';
  }

  function 
drop_session_var($var_name) {
    unset(
$this->session_info[$var_name]);
  }

  function 
get_user_ip() {
    global 
$HTTP_SERVER_VARS$HTTP_ENV_VARS;
    
$ip = (!empty($HTTP_SERVER_VARS['REMOTE_ADDR'])) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ((!empty($HTTP_ENV_VARS['REMOTE_ADDR'])) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv("REMOTE_ADDR"));
    
$ip preg_replace("/[^\.0-9]+/"""$ip);
    return 
substr($ip050);
  }

  function 
get_user_location() {
    global 
$self_url;
    return (
defined("IN_CP")) ? "Control Panel" preg_replace(array("/([?|&])action=[^?|&]*/""/([?|&])mode=[^?|&]*/""/([?|&])phpinfo=[^?|&]*/""/([?|&])printstats=[^?|&]*/""/[?|&]".URL_ID."=[^?|&]*/""/[?|&]l=[^?|&]*/""/[&?]+$/"), array(""""""""""""""), addslashes($self_url));
  }

/* ORIGINAL CODE
   function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }
    }

    if (!empty($l)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }
*/
  
function url($url$amp "&amp;") {
    global 
$l$user_info;
    
$dummy_array explode("#"$url);
    
$url $dummy_array[0];
    
$url str_replace('&amp;''&'$url);
    if (!
defined('IN_CP')) {
      if (
strstr($url'index.php')) {
        
$url str_replace('index.php'''$url);
      }
      elseif (
strstr($url'search.php')) {
        if (
strstr($url'page=')) {
          
preg_match('#page=([0-9]+)&?#'$url$matches);
          if (isset(
$matches[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('search.php''search.'.$matches[1].'.htm'$url);
            
$query str_replace('page='.$matches[1].'&'''$query);
            
$query str_replace('&page='.$matches[1], ''$query);
            
$query str_replace('page='.$matches[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
        else {
          
$url str_replace('search.php''search.htm'$url);
        }
      }
      elseif (
strstr($url'lightbox.php')) {
        if (
strstr($url'page=')) {
          
preg_match('#page=([0-9]+)&?#'$url$matches);
          if (isset(
$matches[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('lightbox.php''lightbox.'.$matches[1].'.htm'$url);
            
$query str_replace('page='.$matches[1].'&'''$query);
            
$query str_replace('&page='.$matches[1], ''$query);
            
$query str_replace('page='.$matches[1], ''$query);
            if (!empty(
$query)) {
                
$url .= '?' $query;
            }
          }
        }
        else {
          
$url str_replace('lightbox.php''lightbox.htm'$url);
        }
      }
      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];
            
$cat_url get_category_url($matches[1]);
            
$url   str_replace('categories.php''cat'.$cat_url.'.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);
        }
      }
      elseif (
strstr($url'details.php?image_id=')) {
        if (
strstr($url'image_id=') && strstr($url'mode=')) {
          
preg_match('#image_id=([0-9]+)&?#'$url$matches1);
          
preg_match('#mode=([a-zA-Z0-9]+)&?#'$url$matches2);
          if (isset(
$matches1[1]) && isset($matches2[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('details.php''img'.$matches1[1].'.'.$matches2[1].'.htm'$url);
            
$query str_replace('image_id='.$matches1[1].'&'''$query);
            
$query str_replace('&image_id='.$matches1[1], ''$query);
            
$query str_replace('image_id='.$matches1[1], ''$query);
            
$query str_replace('mode='.$matches2[1].'&'''$query);
            
$query str_replace('&mode='.$matches2[1], ''$query);
            
$query str_replace('mode='.$matches2[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
        else {
          
preg_match('#image_id=([0-9]+)&?#'$url$matches);
          if (isset(
$matches[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('details.php''img'.get_image_url($matches[1]).'.htm'$url);
            
$query str_replace('image_id='.$matches[1].'&'''$query);
            
$query str_replace('&image_id='.$matches[1], ''$query);
            
$query str_replace('image_id='.$matches[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
      }
      elseif (
strstr($url'postcards.php?image_id=')) {
        
preg_match('#image_id=([0-9]+)&?#'$url$matches);
        if (isset(
$matches[1])) {
          
$split explode('?'$url);
          
$url $split[0];
          
$query = @$split[1];
          
$url   str_replace('postcards.php''postcard.img'.$matches[1].'.htm'$url);
          
$query str_replace('image_id='.$matches[1].'&'''$query);
          
$query str_replace('&image_id='.$matches[1], ''$query);
          
$query str_replace('image_id='.$matches[1], ''$query);
          if (!empty(
$query)) {
            
$url .= '?' $query;
          }
        }
      }
    }
    if (
$this->mode == "get" && strstr($url$this->session_id)) {
      
$url .= strpos($url'?') !== false '&' '?';
      
$url .= SESSION_NAME."=".$this->session_id;
    }
    if (!empty(
$l)) {
      
$url .= strpos($url'?') ? '&' '?';
      
$url .= "l=".$l;
    }
    
$url str_replace('&'$amp$url);
    
$url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
    return 
$url;
  }

//end of class

//-----------------------------------------------------
//--- Start Session -----------------------------------
//-----------------------------------------------------
define('COOKIE_NAME''4images_');
define('COOKIE_PATH''');
define('COOKIE_DOMAIN''');
define('COOKIE_SECURE''0');

// mod GoogleBot
$site_sess = new Session();
$robots = array(
"FAST-WebCrawler" => "searchbot",
"Gulliver" => "searchbot",
"AltaVista" => "searchbot",
"Alexibot" => "searchbot",
"asterias" => "searchbot",
"BackDoorBot" => "searchbot",
"Black.Hole" => "searchbot",
"BlowFish" => "searchbot",
"BotALot" => "searchbot",
"NPBot" => "searchbot",
"Pompos" => "searchbot",
"Scooter" => "searchbot",
"SiteSnagger" => "searchbot",
"Slurp" => "searchbot",
"WebmasterWorldForumBot" => "searchbot",
"zyborg" => "searchbot",
"Google" => "googlebot",
"msnbot" => "searchbot",
"ZACATEK_CZ_BOT" => "searchbot",
"EARTHCOM.info" => "searchbot",
"sherlock" => "searchbot",
"Holmes" => "searchbot",
"ia_archiver" => "searchbot",
"lwp-trivial" => "searchbot",
"appie" => "searchbot",
"Scooter" => "searchbot",
"Gigabot" => "searchbot",
"Wget" => "searchbot",
"jyxobot" => "searchbot",
"Xenu Link Sleuth" => "searchbot",
"SeznamBot" => "searchbot",
);
foreach(
$robots as $key => $val) {
  if(!
$_SERVER['HTTP_USER_AGENT'] || preg_match("/".$key."/i"$_SERVER['HTTP_USER_AGENT'])) {
    
$site_sess->login($val"12345");
    
$user_bot 1
    break; 
  } 
}

// Get Userinfo
$session_info $site_sess->return_session_info();
$user_info $site_sess->return_user_info();
include_once(
realpath(dirname(__FILE__)).'/vb.php');
//-----------------------------------------------------
//--- Get User Caches ---------------------------------
//-----------------------------------------------------
$num_total_online 0;
$num_visible_online 0;
$num_invisible_online 0;
$num_registered_online 0;
$num_guests_online 0;
$user_online_list "";
$prev_user_ids = array();
$prev_session_ips = array();

if (
defined("GET_USER_ONLINE") && ($config['display_whosonline'] == || $user_info['user_level'] == ADMIN)) {
  
$time_out time() - 300;
  
$sql "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.""user_id").get_user_table_field(", u.""user_level").get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_invisible")."
      FROM "
.SESSIONS_TABLE." s
      LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = s.session_user_id)
      WHERE s.session_lastaction >= 
$time_out
      ORDER BY "
.get_user_table_field("u.""user_id")." ASC, s.session_ip ASC";
  
$result $site_db->query($sql);
  while (
$row $site_db->fetch_array($result)) {
    if (
$row['session_user_id'] != GUEST && (isset($row[$user_table_fields['user_id']]) && $row[$user_table_fields['user_id']] != GUEST)) {
      if (!isset(
$prev_user_ids[$row['session_user_id']])) {
        
$is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 0;
        
$invisibleuser = ($is_invisible) ? "*" "";
        
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1) ? sprintf("<b>%s</b>"$row[$user_table_fields['user_name']]) : $row[$user_table_fields['user_name']];
        if (!
$is_invisible || $user_info['user_level'] == ADMIN) {
          
$user_online_list .= ($user_online_list != "") ? ", " "";
          
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/"$row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$row['session_user_id'];
          
/*
  MOD VISITORS COUNTRY FLAGS
  START INSERT
*/
        
$cid geoip_country_code_by_addr($gi$row['session_ip']);
        if (empty(
$cid)) $cid "lan";
        
$countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1;
        
$username "<img src=\"".ROOT_PATH."flags/".strtolower($cid).".gif"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0> ".$username;
/*
  MOD VISITORS COUNTRY FLAGS
  END INSERT
*/   
          
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;
        }
        (!
$is_invisible) ? $num_visible_online++ : $num_invisible_online++;
        
$num_registered_online++;
      }
      
$prev_user_ids[$row['session_user_id']] = 1;
    }
    else {
      if (!isset(
$prev_session_ips[$row['session_ip']])) {
        
$num_guests_online++;
        
/*
  MOD VISITORS COUNTRY FLAGS
  START INSERT
*/
        
$cid geoip_country_code_by_addr($gi$row['session_ip']);
        if (empty(
$cid)) $cid "lan";
        
$countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1;
        
/*
  MOD VISITORS COUNTRY FLAGS
  END INSERT
*/

      
}
    }
    
$prev_session_ips[$row['session_ip']] = 1;
  }
  
/*
  MOD VISITORS COUNTRY FLAGS
  START INSERT
*/
  
$invitado_online_list = array();
  if (!empty(
$countries))
  {
    
asort($countries);
    foreach (
$countries as $key => $val)
    {
      
$invitado_online_list[] = "<font color=\"#00FFFF\">".$val."</font><img src=\"".ROOT_PATH."/flags/".strtolower($key).".gif\" align=\"middle\" alt=\"".(($key != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$key]] : "Unknown or LAN")."\" border=0>";
    }
  }
  
$invitado_online_list implode(" , "$invitado_online_list);
/*
  MOD VISITORS COUNTRY FLAGS
  END INSERT
*/
  
$num_total_online $num_registered_online $num_guests_online;
  
//$num_invisible_online = $num_registered_online - $num_visible_online;

  
$site_template->register_vars(array(
    
"num_total_online" => $num_total_online,
    
"num_invisible_online" => $num_invisible_online,
    
"num_registered_online" => $num_registered_online,
    
"num_guests_online" => $num_guests_online,
    
"invitado_online_list" => $invitado_online_list,
    
"user_online_list" => $user_online_list,
    
"lang_user_online" => str_replace('{num_total_online}'$num_total_online$lang['user_online']),
    
"lang_user_online_detail" => str_replace(array('{num_registered_online}','{num_invisible_online}','{num_guests_online}'), array($num_registered_online,$num_invisible_online,$num_guests_online), $lang['user_online_detail']),
  ));
  
//----------------------------- 
//---Most ever users online---- 
//----------------------------- 
  
$most explode("|"$config['most_users']); 
  
$most_total explode(","$most[0]); 
  
$most_registered explode(","$most[1]); 
  
$most_guests explode(","$most[2]); 
  
$update 0
  if (
$num_total_online $most_total[0]) 
  { 
    
$most_total[0] = $num_total_online
    
$most_total[1] = time(); 
    
$most[0] = $most_total[0].",".$most_total[1]; 
    
$update 1
  } 
  if (
$num_registered_online $most_registered[0]) 
  { 
    
$most_registered[0] = $num_registered_online
    
$most_registered[1] = time(); 
    
$most[1] = $most_registered[0].",".$most_registered[1]; 
    
$update 1
  } 
  if (
$num_guests_online $most_guests[0]) 
  { 
    
$most_guests[0] = $num_guests_online
    
$most_guests[1] = time(); 
    
$most[2] = $most_guests[0].",".$most_guests[1]; 
    
$update 1
  } 
  if (
$update) { 
    
$config['most_users'] = implode("|"$most); 
    
$sql "UPDATE ".SETTINGS_TABLE.
            SET setting_value = '"
.$config['most_users']."' 
            WHERE setting_name = 'most_users'"

    
$site_db->query($sql); 
  } 
  
$site_template->register_vars(array( 
    
"mueo" => $most_total[0], 
    
"mueo_date" => format_date($config['date_format'].", ".$config['time_format'], $most_total[1]), 
    
"mueo_registered" => $most_registered[0], 
    
"mueo_registered_date" => format_date($config['date_format'].", ".$config['time_format'], $most_registered[1]), 
    
"mueo_guests" => $most_guests[0], 
    
"mueo_guests_date" => format_date($config['date_format'].", ".$config['time_format'], $most_guests[1]), 
    
"lang_mueo" => $lang['mueo'], 
    
"lang_mueo_total" => $lang['mueo_total'], 
    
"lang_mueo_date" => $lang['mueo_date'], 
    
"lang_mueo_registered" => $lang['mueo_registered'], 
    
"lang_mueo_guests" => $lang['mueo_guests'], 
  )); 
//End Most Ever Online 
  
$whos_online $site_template->parse_template("whos_online");
  
$site_template->register_vars("whos_online"$whos_online);
  unset(
$whos_online);
  unset(
$prev_user_ids);
  unset(
$prev_session_ips);
}
//Mod_bmollet
/**
 * Get the category url
 * @param int $cat_id The id of the category
 * @param string $cat_url The current status of the URL
 */
function get_category_url($cat_id,$cat_url '')
{
global $site_db;
$sql "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result $site_db->query($sql);
$row $site_db->fetch_array($result);
$row['cat_name'] = strtr($row['cat_name'], "., ABCDEFGHIJKLMNOPQRSTUVWXYZ","---eeeaeauoiiaaabcdefghijklmnopqrstuvwxyz");
$cat_url  '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
 * Get the image url
 * @param int $image_id The id of the image
 */
function get_image_url($image_id)
{
global $site_db;
$sql "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result $site_db->query($sql);
$row $site_db->fetch_array($result);
$row['image_name'] = strtr($row['image_name'], "., ABCDEFGHIJKLMNOPQRSTUVWXYZ","---eeeaeauoiiaaabcdefghijklmnopqrstuvwxyz");
// if you want comlpete path to image in url, remove comment from following line
//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}
?>

If you could help me wrap this up I would really appreciate it... so close to having one  page indexed......
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on June 08, 2009, 02:18:17 AM
Search for
Code: [Select]
    if ($this->mode == "get" && strstr($url, $this->session_id)) {Replace with:
Code: [Select]
    global $user_bot;
    if (!$user_bot && $this->mode == "get" && strstr($url, $this->session_id)) {
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: varoon on July 14, 2009, 01:14:08 PM
Hi

can anyone tell me the full steps for 1.7.7


i m confused...  :?

thx in advance...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Nomad-71 on August 04, 2009, 07:55:08 PM
Hi! I have installed gallery and everything works just fine, except one thing: URL's are looks like http://mysite.com/cat-%category_name%-%category_number.htm?page=3 and I want them to look like http://mysite.com/cat-%category_name%-%category_number-page_number%.htm
How it can be done?
I tried to follow the guide in firs message of this topic.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Kaliha on September 22, 2009, 02:46:36 PM
Можно ли сделать вид ссылки не /img123. htm   а /images/123 например.
how i can do link to my image like /images/123 ??
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on September 22, 2009, 03:28:14 PM
how i can do link to my image like /images/123 ??
This has been asked number of times, the answer is - not possible without heavy modifying 4images. At this moment nobody done it (at least with sharing with the community)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Kaliha on September 22, 2009, 04:00:58 PM
So, this is (/img123. htm) one possible variant of links? And there anyway?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on September 22, 2009, 04:07:10 PM
as in current directory (aka with no extra "/" slashes) - yes.
Though you can change the "img123.htm" to something like "image123.html"
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: ivan on September 22, 2009, 06:01:00 PM
Hi Vano
Wow, this tread is 33 pages long ... very strong!
You can not write an updated version (1.7.7) in a new tread??

... The mod was written a long time ago and for 4images 1.7.0/1 ...

greets ivan
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Sumale.my on September 22, 2009, 07:50:04 PM
This works for me:
http://www.4homepages.de/forum/index.php?topic=17598.msg137711#msg137711
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Kaliha on September 22, 2009, 10:06:35 PM
This mod works perfectly with 1.  7.  7

Sorry, I have not seen the previous message
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: batu544 on December 08, 2009, 04:16:43 AM
Hi,
    I have been using this MOD for a long time.. I don't know how I made it at that time.. My urls are like this.. www.domainname.com/k-category-name-123.htm and detail page urls are like this .. www.domain.com/r-image-name-1234.htm. Its working fine... but now I have noticed that .. Google is trying to find my both the urls and marked them as duplicate content..


Could anyone please let me know how to stop detail.php?image_id=xxxx format urls ?? or is it possible to redirect all the detail.php to r-image-name-123.htm page with 301 code by updating the .htaccessf file ??

A small help will also be appreciated. ..

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: k1lljoy on December 11, 2009, 12:34:44 AM
also, has anyone been able to solve the problem of the category drop-down form?

If I install this mod, my category drop-down no longer works :(
It just redirects to www.mysite.com/cat.htm
whatever option I choose on the dropdown

I searched through the 27 pages but didn't see a solution
have the same problem....  :|
And another one - if someone uses search or clicks on "new posts" - all the thumbnails have the links like "/img2139.search.htm" which is a duplicate for "/img2139.htm", and thats not good for search engines.... Can I have those links without the word "search" in them? :roll:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on December 11, 2009, 02:36:45 AM
also, has anyone been able to solve the problem of the category drop-down form?

If I install this mod, my category drop-down no longer works :(
It just redirects to www.mysite.com/cat.htm
whatever option I choose on the dropdown

I searched through the 27 pages but didn't see a solution
have the same problem....  :|
I can't reproduce on my local server, everything works fine here, with the code from first page. Perhaps it's a server-related?

And another one - if someone uses search or clicks on "new posts" - all the thumbnails have the links like "/img2139.search.htm" which is a duplicate for "/img2139.htm", and thats not good for search engines.... Can I have those links without the word "search" in them? :roll:
This has been discussed here so many times...you'll need deny bots via robots.txt from accessing anything search related.


And to anyone asking questions regarding search engine bots: control what they can and can't access via robots.txt.
Search the web for more info.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: k1lljoy on December 11, 2009, 02:14:38 PM
also, has anyone been able to solve the problem of the category drop-down form?

If I install this mod, my category drop-down no longer works :(
It just redirects to www.mysite.com/cat.htm
whatever option I choose on the dropdown

I searched through the 27 pages but didn't see a solution
have the same problem....  :|
I can't reproduce on my local server, everything works fine here, with the code from first page. Perhaps it's a server-related?
I dunno, but I have had this small "bug" on all of 3 hosting servers I've moved on lately... And your local server, is it Windows or still Linux/*nix?  :roll:

And another one - if someone uses search or clicks on "new posts" - all the thumbnails have the links like "/img2139.search.htm" which is a duplicate for "/img2139.htm", and thats not good for search engines.... Can I have those links without the word "search" in them? :roll:
This has been discussed here so many times...you'll need deny bots via robots.txt from accessing anything search related.


And to anyone asking questions regarding search engine bots: control what they can and can't access via robots.txt.
Search the web for more info.
Thanks, Vano, yeah, I know about the possibility to bar SE bots from indexing some types of links on the site by means of "disallow" strings in robots.txt file.
But nonetheless I would still like to know if its possilbe to get rid of those "search" inclusions into the "img....htm" URLs, cause not only search engines dont like those thinhs, but me actually as wel  :) Those pages have no distinctions on them, and therefore are simple detail-pages with duplicated content and different URLs, so I cannot understand why that "search"-word should stay there  :|
Or maybe it has some original explanation and logical grounding?  :)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on December 11, 2009, 02:33:11 PM
The "search" mode is needed for next/prev links at image details page. It has the same purpose as "lightbox" mode. By removing this it will probably affect your server's load because visitors will  most likely have to refresh the search results after viewing details of one image in order to see next image from that search (perform search, view one image, go back, search again, view next image, so on)

in search.php replace
    show_image($image_row, "search");
with:
    show_image($image_row);
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: k1lljoy on December 11, 2009, 02:53:14 PM
Thanks, V@no! Now I see why its needed, just didn't pay attention to the fact, that while visiting such pages (with that search-tag) we get next/prev search results but not photos from the same category as usual  :P

The "search" mode is needed for next/prev links at image details page. It has the same purpose as "lightbox" mode. By removing this it will probably affect your server's load because visitors will  most likely have to refresh the search results after viewing details of one image in order to see next image from that search (perform search, view one image, go back, search again, view next image, so on)

in search.php replace
    show_image($image_row, "search");
with:
    show_image($image_row);

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: k1lljoy on December 18, 2009, 04:30:41 AM
also, has anyone been able to solve the problem of the category drop-down form?

If I install this mod, my category drop-down no longer works :(
It just redirects to www.mysite.com/cat.htm
whatever option I choose on the dropdown

I searched through the 27 pages but didn't see a solution
have the same problem....  :|
I can't reproduce on my local server, everything works fine here, with the code from first page. Perhaps it's a server-related?
If I have "form method="post" in my category_dropdown_form.html - then after choosing any category from a dropdown-menu a person gets redirected right but gets the wrong address in URL (always just /cat.htm without any numbers).
 If I change it to "form method=get" - then I get redirected right as well, but get URLs like "/cat.htm?cat_id=68" instead of just "/cat68.htm"...

Is it possible to correct that issue plz? :roll:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on December 18, 2009, 06:36:23 AM
That is how POST method works, it's not a bug and it's not a problem. Also, even though it shows cat.html in the url, it opens correct category.
Nothing you can do about it (unless you want play with javascript and on-fly change the form's action value).

[EDIT]
Here is javascript part that can be used for this matter:
In includes/functions.php find:
      $category = "\n<select name=\"".URL_CAT_ID."\" onchange=\"if (this.options[this.selectedIndex].value != 0){ forms['jumpbox'].submit() }\" class=\"categoryselect\">\n";

Replace it with:
      $category = "\n<select name=\"".URL_CAT_ID."\" onchange=\"if (this.options[this.selectedIndex].value != 0){ forms['jumpbox'].setAttribute('action',forms['jumpbox'].getAttribute('action').replace('cat\.','cat'+this.options[this.selectedIndex].value+'.'));this.disabled=true;forms['jumpbox'].submit();this.disabled=false; }\" class=\"categoryselect\">\n";
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: k1lljoy on December 18, 2009, 08:38:52 AM
V@no, that worked out again!  :D
I already dunno how to thank you and requite your patience and assistance!  :o

I'm a bit impudent and importunate... but - maybe you may have an answer to this question?  :roll:
http://www.4homepages.de/forum/index.php?topic=7700.msg143631#msg143631  :oops:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: k1lljoy on December 22, 2009, 07:22:44 AM
After completing my upgrade from 1.7.4 to 1.7.7 (making changes in sessions.php in particular) I now notice that some URLs with sessionid=... at the end are starting to appear again for me, for some of my friends, and for search engine bots (google, yandex etc) ...  :|

I found in backed-up copies, that I previously had the following snippet of code in my includes/sessions.php:
Code: [Select]
   if ($this->mode == "get" && strstr($url, $this->session_id)) {
      $url .= strpos($url, '?') !== false ? '&' : '?';
      $url .= SESSION_NAME."=".$this->session_id;
    }
    if (!empty($l)) {
      $url .= strpos($url, '?') ? '&' : '?';
      $url .= "l=".$l;
    }

And right now I changed it to the following:
Code: [Select]
   if ($this->mode == "get" && strpos($url, $this->session_id) === false) {
      $url .= strpos($url, '?') !== false ? $amp : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= strpos($url, '?') !== false ? $amp : "?";
      $url .= "l=".$l;
    }

May that be the reason?
And another question - if that was the reason, may I simply undo those changes without any harm to the script itself or causing its malfunctioning ?

Or maybe I should better try to implement the change, described by you here: http://www.4homepages.de/forum/index.php?topic=6729.msg59251#msg59251  :?:


Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on December 22, 2009, 03:21:14 PM
The second code is correct code.
Yes, you could try do the bot support code.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: k1lljoy on December 22, 2009, 03:50:54 PM
The second code is correct code.
Yes, you could try do the bot support code.
Thanx!
And the follow-up question:
If I have that second code in sessions.php (above-mentioned by me in the previous post) - and when I set in my browser to block all cookies - is that right, that the appearing sessionid changes each time I press F5 (i.e. reload the page) ?  :|  Cause my IP isn't changing, my session isn't as well I guess...  :?:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@nо on December 22, 2009, 09:22:08 PM
yes, that is correct. 4images does't care at which ip the request came from. some isp work as proxy, and each refresh could come from different ip (i.e. everyone's favourite aol)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: k1lljoy on January 06, 2010, 06:07:28 AM
Well, it looks like SE bots get sessionid on their first visit now and thus just stop crowling the site cause URLs with sessonid are prohibited to index through robots.txt rules  :|
And ppl start posting URLs with thier sessionid's sometimes...
And with the purpose to get rid of those vulnerabilities and disadvantages, and inconveniences for search engines' indexing I've decided to switch off the sessionid feature totally. Is that possible?  :roll:
 I clearly understand that some percentage of people after those changes would not be able to login or browse through search results... but lots of sites use just the cookie feature for authorization and other things, and they are doing quite well  :)


Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on January 06, 2010, 02:49:00 PM
Just use the code, I believe provided somewhere in this topic, that would switch off sessionid for the bots only...If I recall correctly that code is based on "treat bots as members" mod or something like that..
Sorry, I don't have time at the moment to be more specific, but it's there ;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: k1lljoy on January 07, 2010, 06:29:53 PM
Just use the code, I believe provided somewhere in this topic, that would switch off sessionid for the bots only...If I recall correctly that code is based on "treat bots as members" mod or something like that..
Sorry, I don't have time at the moment to be more specific, but it's there ;)
Thanks, Vano, but that solution works only for search-bots, and as far as I know - even they are still getting sessionids on their first visit...not to say about the simple visitors...
And I want to get rid of that sessionid completely, so theat nobody could never see it again  :D

I tried different methods, and must say now, that right now I've just undone the changes in includes/sessions.php, which i described here: http://www.4homepages.de/forum/index.php?topic=6729.msg144014#msg144014
that is - I've made it look like:
Code: [Select]
  if ($this->mode == "get" && strstr($url, $this->session_id)) {
      $url .= strpos($url, '?') !== false ? '&' : '?';
      $url .= SESSION_NAME."=".$this->session_id;
    }
    if (!empty($l)) {
      $url .= strpos($url, '?') ? '&' : '?';
      $url .= "l=".$l;
    }
And all the sessions are gone now!  8)

I really do not know, maybe this snippet of code is wrong in some way, inappropriate or something else, but right now ny site works fine and the sessionids' are gone - so it turned out to be a solution for me.
 So - if someone wants to get rid of sessionsids' completele - You should probably try it as well  :roll:

Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on January 08, 2010, 12:54:11 AM
just remove
      $url .= strpos($url, '?') !== false ? $amp : "?";
      $url .= SESSION_NAME."=".$this->session_id;
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: MrAndrew on May 18, 2010, 11:39:15 AM
Works fine, THANKS

But, can i do next:

From:
http://my.domain/img990.htm?l=russian

To:
http://my.domain/photo/{additional fields}/image_id

Or simething like that???
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: muhammet93 on July 23, 2010, 06:25:16 PM
I have a question.
For example, have cars category, and inside it there is a picture named renault.
I want to use www.domainname.com/cars/renault link to enter to the picture.Is that possible?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on July 24, 2010, 01:11:08 AM
[MOD] Google Friendly Urls For 4images Best Seo Mod (http://www.4homepages.de/forum/index.php?topic=17598.0)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: MrAndrew on September 19, 2010, 10:12:00 PM
1 question.

 Ok. All work done. But how to merge together this: http://www.4homepages.de/forum/index.php?topic=6729.msg57268#msg57268 and this: http://www.4homepages.de/forum/index.php?topic=6729.msg48487#msg48487

Please can you give me ready code?

1.1 question

This is my path.  How will be see this path after merging?
 RewriteRule ^img/(.*)/([0-9]+)/ details.php?image_id=$2&%{QUERY_STRING}


Thanks!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on September 19, 2010, 10:19:43 PM
[MOD] Google Friendly Urls For 4images Best Seo Mod (http://www.4homepages.de/forum/index.php?topic=17598.0)

What exactly you want to merge?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: MrAndrew on September 21, 2010, 06:23:18 PM
I made this type of my links http://domain.ru/photo-uzbekistan-airways-boeing-767-3cb(28er)29-2746.htm

Before it link was: http://domain.ru/img1676.htm

Now this link is not available and get error 404. http://domain.ru/img1676.htm May i do a redirect? If, yes. How?

Many thanks
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on September 21, 2010, 06:51:39 PM
The simplest solution would be just leave support for the old type of URLs:
Code: [Select]
RewriteRule ^img([0-9]+)\.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.([a-zA-Z0-9]+)\.htm$ details.php?image_id=$1&mode=$2&%{QUERY_STRING}
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: MrAndrew on September 21, 2010, 07:33:03 PM
Why do you think that? Is it not better in terms of SEO optimization? Thanks for code!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on September 21, 2010, 07:45:52 PM
no, it is not better, but at least you don't get 404 errors ;) It's just the simplest way.

The more difficult way is to redirect from within details.php and it is not very optimized way either. If you still want go that way, I may try cook something for you later today.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: MrAndrew on September 21, 2010, 07:52:54 PM
Ok, will be very interesting to try and finished this. I`ll be awaiting for you. Thanks V@no!
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on September 21, 2010, 09:43:26 PM
ok, here it is.
in htaccess add these lines:

Code: [Select]
RewriteRule ^img([0-9]+)\.htm$ details.php?image_id=$1&old&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.([a-zA-Z0-9]+)\.htm$ details.php?image_id=$1&mode=$2&old&%{QUERY_STRING}

In details.php find:
require(ROOT_PATH.'includes/sessions.php');

Insert below :below::
if (isset($HTTP_GET_VARS['old']))
{
  unset($HTTP_GET_VARS['old']);
  $query = "";
  foreach($HTTP_GET_VARS as $key => $val)
  {
    $query .= "&" . $key . "=" . $val;
  }
  $query = trim($query, "&");
  header('HTTP/1.1 301 Moved Permanently');
  redirect(ROOT_PATH . "details.php" . ($query ? "?" . $query : ""));
}
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: MrAndrew on September 21, 2010, 09:52:29 PM
Special thanks this work perfectly. And last question:

In my details.html i show to users link to the photo throught this code

<a href="<?=$site_sess->url(ROOT_PATH."details.php?image_id={image_id}")?>">http://domain.ru/<?=$site_sess->url(ROOT_PATH."details.php?image_id={image_id}")?></a>

Why this path show me this type of link?

http://domain.ru/./photo-vim-airlines-ilyushin-il-62m-1676_

 Where i need to delete ./?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on September 21, 2010, 09:55:04 PM
because of ROOT_PATH constant.
This should work:

Code: [Select]
<a href="<?=$site_sess->url("details.php?image_id={image_id}")?>">http://domain.ru/<?=$site_sess->url("details.php?image_id={image_id}")?></a>
but keep in mind, this type of URL will contain sessionid= if cookies are blocked or on very first visit the page, this is not recomended for links that visitors would use to share with others.
A possible work around this issue is use this instead:
Code: [Select]
<?php
$backupGet 
$site_sess->get;
$site_sess->get "cookie";
?>

<a href="<?=$site_sess->url("details.php?image_id={image_id}")?>">http://domain.ru/<?=$site_sess->url("details.php?image_id={image_id}")?></a>
<?php
$site_sess
->get $backupGet;
?>
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: MrAndrew on September 21, 2010, 10:02:20 PM
Very nice. Now my link of details page seen more beauty and comfort for my users! Thanks you very much V@no. In future i want to apply a "/" to the links. I can do it. But then the photo will not be visible. Because it will apply to the wrong address. How to fix it I do not know
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on September 21, 2010, 11:02:19 PM
can't answer that without knowing what exactly changes you do.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: relu on November 01, 2010, 10:45:56 PM
hi, i searched about the way to add for thumbnail in html width= and height= this is missing from my html code. Somebody know where i must looking for?
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: jeyjoo on March 27, 2011, 05:20:26 PM
I am running version Version: 1.7.6
my gallery is http://www.jeyjoo.com/gallery/index.php

I have tried different mods on this thread, and each time broke my gallery and had to restore original settings.
I am trying to  give each URL as a simple http://mygallery.com/gallery/details.php?image_id=239, ie. remove all the url endings such as &mode=search.

Is there a way to do this?
Much appreciated
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: V@no on March 27, 2011, 05:40:16 PM
Are you trying cripple functionality of your gallery? these "mode=" endings are not for decoration, you know...;)
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: jeyjoo on July 27, 2011, 12:27:54 PM
Seriously is there any way I can provide static URLS.
I am on 1.7.6, and cannot get this to work.

Ideally am looking to have a url of the sort: http://www.jeyjoo.com/gallery/{image_id}_{image_name}

Any ideas?

Thanks,
Mike
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: swarzy on September 23, 2011, 05:18:38 AM
hello, I've replaced the files you put in the first part of the post (. htaccess and sessions.php) and I get the following:

http://www.swarzycustom.com/r-galletas-dvd-2-g-13-giallo-4660.htm

I want you to stay well

http://www.swarzycustom.com/giallo.htm

What I have to change?

thanks ...
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: rashidkhalil on November 28, 2011, 02:58:34 PM
hello dear sir

Google / Sitemap Problem now ...

movies.fm95pakistan.com it my website but

google site map error

please resolve in this issues

thanks
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: marcinos on January 12, 2012, 06:48:10 PM
to address how to make html pages to look was in this form

www.sitename/search.php?q=keywords
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Naveen on June 26, 2012, 06:45:25 PM
Ok, I have been using this mod for quite a few years now and I have had no issues untill today.

Somehow google had crawled pages with search extension i.e

Normal image url = http://www.domain.com/img123.htm
Issue URL = http://www.domain.com/img123.search.htm

This has resulted in 100s of duplicate url in google webmaster sitemaps.

http://www.domain.com/img123.search.htm  for odd reasons returns next and previous images as http://www.domain.com/img122.search.htm  and next images as http://www.domain.com/img124.search.htm

How do I get rid of this now?  :oops:
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: sathishIPL on June 27, 2012, 11:43:24 AM
Hi,

Please click the below link to solve the duplicate

http://www.4homepages.de/forum/index.php?topic=17598.0;msg=158361 (http://www.4homepages.de/forum/index.php?topic=17598.0;msg=158361)

Best Regards,
satz
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: Naveen on June 28, 2012, 09:21:18 AM
I already have canonical tag working on each page. However that is not the solution to the problem, I need to get rid of (*.search.htm) Infact anything.htm works and loads the page. i.e

http://www.domain.com/img123.(anythinghere).htm  <--- this should not happen.
Title: Re: [Mod] Search Engine Friendly URLs aka Short URLs
Post by: son_gokou on March 23, 2014, 02:19:02 AM
Hello.

How can I change this:
for image --->http://www.your-site.com/img-imagename-andnumber.htm
category --->http://www.your-site.com/cat-categoryname-andnumber.htm

To this?
for image --->http://www.your-site.com/imagename.htm
category --->http://www.your-site.com/categoryname.htm


Here's "my" MOD:

Code: [Select]
 
=================================================
1. at the end of .htaccess, add following code :
=================================================
#Mod_bmollet : category name in URL
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}

#Mod_bmollet : This is to make search function work  ( redirect links from search results )
RewriteRule ^img([0-9]+).search.htm details.php?image_id=$1&%{QUERY_STRING}

=======================================================================

=========================================
2. add this code to include/sessions.php
=========================================
//Mod_bmollet
/**
 * Get the category url
 * @param int $cat_id The id of the category
 * @param string $cat_url The current status of the URL
 */
function get_category_url($cat_id,$cat_url = '')
{
global $site_db;
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['cat_name'] = strtr($row['cat_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$cat_url  = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
 * Get the image url
 * @param int $image_id The id of the image
 */
function get_image_url($image_id)
{
global $site_db;
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['image_name'] = strtr($row['image_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
// if you want comlpete path to image in url, remove comment from following line
//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}
========================================================================

========================================================================
3. In include/sessions.php replace function url(...) by following code.
========================================================================
/* ORIGINAL CODE
  function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }
*/
  function url($url, $amp = "&amp;") {
    global $l, $user_info;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];
    $url = str_replace('&amp;', '&', $url);
    if (!defined('IN_CP')) {
      if (strstr($url, 'index.php')) {
        $url = str_replace('index.php', '', $url);
      }
      elseif (strstr($url, 'search.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('search.php', 'search.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('search.php', 'search.htm', $url);
        }
      }
      elseif (strstr($url, 'lightbox.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('lightbox.php', 'lightbox.'.$matches[1].'.htm', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
                $url .= '?' . $query;
            }
          }
        }
        else {
          $url = str_replace('lightbox.php', 'lightbox.htm', $url);
        }
      }
      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_re