[BETA] SEO Urls V2

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
mgutt
Registered User
Posts: 346
Joined: Tue Sep 21, 2004 2:54 pm
Location: Germany, Sankt Augustin
Contact:

Post by mgutt »

Its a bug in the reputation mod. this line:

Code: Select all

$reputation .=  " <a href=\""  . append_sid("reputation.$phpEx?a=add&" . POST_USERS_URL . "=" . $postrow[$i]['user_id']) . "&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&c=" . substr(md5($bbcode_uid),0,8) . "\" target=\"_blank\" onClick=\"popupWin = window.open(this.href, '" . $lang['Reputation'] . "', 'location,width=700,height=400,top=0,scrollbars=yes'); popupWin.focus(); return false;\"><img src=\"images/reputation_add_plus.gif\" alt=\"\" border=\"0\"><img src=\"images/reputation_add_minus.gif\" alt=\"\" border=\"0\"></a>";
must be written as follows:

Code: Select all

$reputation .=  " <a href=\""  . append_sid("reputation.$phpEx?a=add&" . POST_USERS_URL . "=" . $postrow[$i]['user_id'] . "&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&c=" . substr(md5($bbcode_uid),0,8)) . "\" target=\"_blank\" onClick=\"popupWin = window.open(this.href, '" . $lang['Reputation'] . "', 'location,width=700,height=400,top=0,scrollbars=yes'); popupWin.focus(); return false;\"><img src=\"images/reputation_add_plus.gif\" alt=\"\" border=\"0\"><img src=\"images/reputation_add_minus.gif\" alt=\"\" border=\"0\"></a>";
Forums: Honda || phpBB Categories Hierarchy
Mods: Spamfilter against bot registrations || Seo Urls
User avatar
Solinarius
Registered User
Posts: 16
Joined: Thu Aug 04, 2005 11:58 pm
Location: PL / Koszalin
Contact:

Post by Solinarius »

thanks for so quick answer!
www.lastinn.info -rpg online ;)
dosser
Registered User
Posts: 10
Joined: Fri Jun 16, 2006 2:36 am

.htaccess

Post by dosser »

Big thanks for all your work on this mgutt - superb mod.

All the links are now properly formatted - the only thing is my homepage now will not load. I think this is due to some problem with the root .htaccess file as I have had to add a couple of lines of my own cos my server otherwise doesn't do php5 which i need.

The homepage should be home.php4 and when i type it in long hand (/home.php4) it loads fine, but otherwise I get a 403 forbidden error. And by the way it was working fine before I added the mod. My forum is in /forum/ etc

Code: Select all

AddType x-mapp-php5 .php


<Files config.php> 
Deny from all 
</Files> 

DirectoryIndex index.php index.html index.htm

RewriteEngine On

# SEO URL [mgutt]
RewriteRule !\.html$ - [L]
RewriteRule ^forum/[a-z0-9-]+-([pt])([0-9]+)\.html$ /forum/viewtopic.php?$1=$2 [L]
RewriteRule ^forum/[a-z0-9-]+-f([0-9]+)\.html$ /forum/viewforum.php?f=$1 [L]
RewriteRule ^forum/[a-z0-9-]+-c([0-9]+)\.html$ /forum/index.php?c=$1 [L]
RewriteRule ^forum/[a-z0-9-]+-u([0-9]+)\.html$ /forum/profile.php?mode=viewprofile&u=$1 [L]
RewriteRule ^forum/([a-zA-Z0-9_]+),([^/,]+),([^/,]*)([^/]*\.html)$ forum/$1$4?$2=$3 [QSA,N]
RewriteRule ^forum/[a-z0-9-]+-([pt])([0-9]+),([^/,]+),([^/,]*)([^/]*\.html)$ forum/viewtopic$5?$1=$2&$3=$4 [QSA,N]
RewriteRule ^forum/[a-z0-9-]+-f([0-9]+),([^/,]+),([^/,]*)([^/]*\.html)$ forum/viewforum$4?f=$1&$2=$3 [QSA,N]
RewriteRule ^forum/([a-zA-Z0-9_]+)\.html$ /forum/$1.php [L]

Any idea what is going? Thanks very much in advance.
mgutt
Registered User
Posts: 346
Joined: Tue Sep 21, 2004 2:54 pm
Location: Germany, Sankt Augustin
Contact:

Post by mgutt »

You directory index is home.php4?

try to change the index and add your file:

Code: Select all

DirectoryIndex home.php4 index.php index.html index.htm 
And change it in your sessions.php if it is called in the forum pages as well.

regards
Forums: Honda || phpBB Categories Hierarchy
Mods: Spamfilter against bot registrations || Seo Urls
cissss
Registered User
Posts: 1
Joined: Thu Mar 29, 2007 8:13 am

Re: [BETA] SEO Urls V2

Post by cissss »

SOS!!!

i just install the MOD,but when i go to my sit it says:

Parse error: syntax error, unexpected ',' in /home/mysite/public_html/includes/sessions.php on line 734

i'm not a PHP pro,so i don't know what happened

here is my sessions.php

http://www.wwefish.com/sessions.txt


plz,help me~
dosser
Registered User
Posts: 10
Joined: Fri Jun 16, 2006 2:36 am

Re: [BETA] SEO Urls V2

Post by dosser »

Thanks for the tip mgutt worked great and now all the urls and homepage are working great.

The only problem - I have an external login/logout for the forum in the root directory of my site (the forum being http://www.mysite.com/forum/). As such it uses a redirect to return to eg the homepage having logged in/logged out. The login still works fine, and redirects to the correct url but the logout returns a url such as eg http://www.mysite.com/home4id,0.html instead of http://www.mysite.com/home4.php.

What I want to know is can I put an exception in my .htaccess file so that the seo-url mod ignores all login.php urls and if so would this even work (seems strange to me that the login section works fine but the logout does not even though both require the login.php script? I have tried the following without success both before and after the final RewriteRule -

Code: Select all

RewriteRule ^forum/login\.php$ /forum/login.php?logout=true&sid=$1&redirect=$2&outside=1 [L]


Is there some way of adding an exception and if so where should it be placed in the .htaccess file? At the end of the RewriteRules or somewhere in the middle?

Many thanks.

CD
saxena
Registered User
Posts: 6
Joined: Thu Jun 22, 2006 5:57 pm

Re: [BETA] SEO Urls V2

Post by saxena »

You need the apache modul "mod_rewrite" to use this mod.


Will this work on other PHP based applications 8)
Top_Speed
Registered User
Posts: 42
Joined: Fri Dec 31, 2004 3:19 pm

Re: [BETA] SEO Urls V2

Post by Top_Speed »

Thanks mg
Works great!

One thing- I have a mod that write the top xx rated posts to my index page and the urls are not quite right. They all show the last post in the last forum/thread as their url but all do have the correct thread # on the tail of the url.

This is a possible "seo duplicate spam issue" with the SE's. Any ideas on how the "top 10 taed posts" can have their URL correct?

Many Thanks,
Speed
amin_ch
Registered User
Posts: 6
Joined: Tue Jun 07, 2005 5:00 pm

Re: [BETA] SEO Urls V2

Post by amin_ch »

Hello

Where I can find file constants.php ?
I don't see this file in root directory.
Thanks.

Amin Ch.
gansert
Registered User
Posts: 581
Joined: Wed Mar 08, 2006 8:48 pm
Location: KÖLN, GERMANY
Contact:

Re: [BETA] SEO Urls V2

Post by gansert »

amin_ch wrote: Hello

Where I can find file constants.php ?
I don't see this file in root directory.
Thanks.

Amin Ch.


Have a look in FOLDER

Code: Select all

/includes

Code: Select all

root/includes/constants.php
mgutt
Registered User
Posts: 346
Joined: Tue Sep 21, 2004 2:54 pm
Location: Germany, Sankt Augustin
Contact:

Re: [BETA] SEO Urls V2

Post by mgutt »



Use an other html editor and reinstall the mod.
dosser wrote: The login still works fine, and redirects to the correct url but the logout returns a url such as eg http://www.mysite.com/home4id,0.html instead of http://www.mysite.com/home4.php.


Add "home4.php?id" to your forbidden files in sessions.php.
saxena wrote:
You need the apache modul "mod_rewrite" to use this mod.


Will this work on other PHP based applications 8)


Sorry, I did not understand your question. Try to install the mod or upload the .htaccess only. If your site loads without any errors it could be possible to install my mod.
Top_Speed wrote: One thing- I have a mod that write the top xx rated posts to my index page and the urls are not quite right.


Please give us an example of the "wrong" url. Paste your code where the xx rated posts are read and displayed with.
Forums: Honda || phpBB Categories Hierarchy
Mods: Spamfilter against bot registrations || Seo Urls
Top_Speed
Registered User
Posts: 42
Joined: Fri Dec 31, 2004 3:19 pm

Re: [BETA] SEO Urls V2

Post by Top_Speed »

Thanks for the response mg...

indexbody.tpl line...

Code: Select all

<TD>{RATING_INDEX}</TD>
Here is the rating_index_body.tpl

Code: Select all

<table width="100%" cellpadding="0" cellspacing="0" border="0" class="forumline">
	
	<!-- BEGIN notopics -->
		<td class="row3" align="left" valign="top"><span class="gensmall">&nbsp;{notopics.MESSAGE}</span></td>
	<!-- END notopics -->
	<!-- BEGIN ratingrow -->
	<tr>
		<td class="row3" align="right" valign="top"><span class="gensmall">{ratingrow.RATING} :&nbsp;</td><td class="row3" width="87%" align="left" valign="top"> <a href="{ratingrow.URL}">{ratingrow.TITLE}</a></span></td>
	</tr>
	<!-- END ratingrow -->
</table>
And here is the rating.php itself...

Code: Select all

<?php
/***************************************************************************
*                            $RCSfile: rate.php,v $
*                            -------------------
*   begin                : Saturday, May 08, 2003
*   copyright            : (C) 2002-2003 Nivisec.com
*   email                : [email protected]
*
*   $Id: rate.php,v 2.4 2003/05/21 18:49:27 nivisec Exp $
*
*
***************************************************************************/

/***************************************************************************
*
*   This program is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation; either version 2 of the License, or
*   (at your option) any later version.
*
***************************************************************************/

define('IN_PHPBB', TRUE);
$phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

/*******************************************************************************************
/** Start session.
/******************************************************************************************/
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);

/*******************************************************************************************
/** Get parameters.
/******************************************************************************************/
$params = array('rate_mode', 'forum_top', 'topic_id', 'rating');

foreach($params as $var)
{
	$$var = '';
	if( isset($HTTP_POST_VARS[$var]) || isset($HTTP_GET_VARS[$var]) )
	{
		$$var = ( isset($HTTP_POST_VARS[$var]) ) ? $HTTP_POST_VARS[$var] : $HTTP_GET_VARS[$var];
	}
}
/*******************************************************************************************
/** Page Titles if Specific!
/******************************************************************************************/
switch($rate_mode)
{
	case 'rate':
			$page_title = $lang['Rating'];
	case 'rerate':
	break;
	case 'detailed':
	{
		if ($topic_id == '')
		{
			message_die(GENERAL_ERROR, $lang['No_Topic_ID'], '', __LINE__, __FILE__);
		}
		$page_title = $lang['Topic_Rating_Details'];
		break;
	}
	default:
	{
		if ($forum_top == '')
		{
			$forum_top = -1;
		}
		$page_title = sprintf($lang['Top_Topics'], $board_config['large_rating_return_limit']);
		break;
	}
}
/*******************************************************************************************
/** Include Header (It Contains Rate Functions).
/******************************************************************************************/
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

/*******************************************************************************************
/** Display modes, for if the page is called seperately
/******************************************************************************************/
switch($rate_mode)
{
	case 'rate':
			rate_topic($userdata['user_id'], $topic_id, $rating, 'rate');
			break;
	case 'rerate':
				rate_topic($userdata['user_id'], $topic_id, $rating, 'rerate');
	break;
	case 'detailed':
	{
		ratings_detailed($topic_id);
		break;
	}
	default:
	{
		ratings_large();
		break;
	}
}
nivisec_copyright();
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
Many thanks for looking at this!!
~Speed
dosser
Registered User
Posts: 10
Joined: Fri Jun 16, 2006 2:36 am

Re: [BETA] SEO Urls V2

Post by dosser »

Thanks mcgutt worked a charm!

CD
mgutt
Registered User
Posts: 346
Joined: Tue Sep 21, 2004 2:54 pm
Location: Germany, Sankt Augustin
Contact:

Re: [BETA] SEO Urls V2

Post by mgutt »

@ top speed

post the file where template var "URL" is defined.

regards
Forums: Honda || phpBB Categories Hierarchy
Mods: Spamfilter against bot registrations || Seo Urls
Adavis
Registered User
Posts: 25
Joined: Wed Dec 31, 2003 1:53 pm

Re: [BETA] SEO Urls V2

Post by Adavis »

I have a phpBB in greek. Can I use this mod?
Adavis
Post Reply

Return to “[2.0.x] MODs in Development”