Coder Social home page Coder Social logo

tas2580 / seourls Goto Github PK

View Code? Open in Web Editor NEW
44.0 13.0 25.0 264 KB

phpBB Extension: URL rewriting for phpBB forums

Home Page: https://tas2580.net/downloads/phpbb-seo-url/

License: GNU General Public License v2.0

PHP 96.61% Shell 3.39%
phpbb seo-friendly-urls seo url rewrite phpbb-extension phpbb-forum

seourls's Introduction

phpBB SEO URLs

This is an extension for the phpBB forums software. You need an instalation of phpBB 3.1.x or 3.2.x to use this extension.

Download Donate

DESCRIPTION

Changes the URLs of forums and topics too more SEO friendly URLs with the title of the forums and topics in it. This extension is held as simple as possible, it contains no ACP, you can just install it and use the SEO friendly URLs.

  • /viewforum.php?f=1 becomes /forum-title-f1/
  • /viewtopic.php?f=1&t=2 becomes /forum-title-f1/topic-title-t2.html

XML Sitemap

If you search for a SEO XML sitemap, look at this Extension

INSTALLATION

To install this extension download it from here and upload the files in your forum under /ext/tas2580/seourls. Make changes on your Webserver configuration. After that go to the Admin panel of your forum and navigate in to Customise -> Extension Management -> Extensions. Search this extension in the list of extensions and click on Enable.

URL Rewriting

See: https://github.com/tas2580/seourls/wiki/Webserver-configuration

SUPPORT

You can get support for this extension on phpbb.com or in german on phpbb.de. For more informations look at my Website.

Old phpBB Versions

phpBB 2.0.x
Download ZIP | View Branch

phpBB 3.0.x
Download ZIP | View Branch

LICENSE

GNU General Public License v2

Automated Testing

We use automated unit tests to prevent regressions. Check out our travis build below:

Build Status Scrutinizer Code Quality

seourls's People

Contributors

b-vetter avatar blaues0cke avatar csch0 avatar hanprower avatar k07h avatar naguissa avatar nivit avatar ronaldkools avatar rsobon avatar stanley89 avatar tas2580 avatar xyzizix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

seourls's Issues

Forum Category not work

Forum Category not work. Only the forum work.
For the category the url remains: viewforum.php?f=

SEO urls Pretty for search Jump to post

I discovered Jump to post link in search results didn't have pretty urls, so i fixed in your extenstion with this line : $tpl_ary['U_VIEW_POST'] = $tpl_ary['U_VIEW_TOPIC'].'#p'.$event['row']['post_id'];
Added to function search_modify_tpl_ary, under $event['tpl_ary'] = $tpl_ary;
And it's works, have pretty url same like topic but added post_id param on the end

Screenshot where to add: https://ibb.co/8Mw1vYc

Errors with php 8.0

Hi, with phpbb 3.3.1 or 3.3.2 and php 7.4 this extension (i use the latest version 0.3.4) works fine, but with php 8.0 i have some errors.
When i go on a topic or post, i get those errors at the top of the page :

[phpBB Debug] PHP Warning: in file [ROOT]/ext/tas2580/seourls/event/listener.php on line 439: Undefined array key "post_id"

[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4130: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3009)

Any idea to fix this?

Edit : I tried phpbb 3.3.2 with php 7.4 and 8.0 when i disable this extension, it works fine in both cases.

Thanks,

Pierre

notification links

forum/index.php?mark_notification=xxxx
changed automatically to
forum/

Does not work with 3.2.*

I failed to get this mod working on PHPBB 3.2.0 and 3.2.1

Proposed fix is not working. It resets the forum style to the default removing all custom styles, and conflicts with phpBB3 SEO Sitemap 1.1.1 which is not showing the new SEO URLs as it should.

Original issue:

Original URL: https://www.forum.2globalnomads.info/viewforum.php?f=16

The same URL using extension: https://www.forum.2globalnomads.info/it-hosting-blogging-and-gaming-f16/

Result: No route found for "GET /it-hosting-blogging-and-gaming-f16/" (from "https://www.forum.2globalnomads.info/")

nginx rewrites rules

In the readme and/or description we ought to include nginx rewrite rules as this webserver is rather popular.

SCRIPT_NAME eq 'viewtopic' bug

SCRIPT_NAME eq 'viewtopic' doesnt work since SCRIPT_NAME is viewtopic/someforum/sometopic

That makes many extensions to not work properly since it depends on that script_name

Error with stacked forum in last post

If you have subforums in your forum there is an in the link for the last post.
For Example

  • Forum 1
    • SubForum
      • FirstPost

I found an quick&dirty solution in the listener.php for the function:

public function display_forums_modify_template_vars($event)

Replace the line:

$url = $this->generate_topic_link($event['row']['forum_id'], $event['row']['forum_name'], $event['row']['topic_id'], $event['row']['topic_title']);

with:

                $sql = 'SELECT p.post_id, p.topic_id, p.forum_id, f.forum_name
                        FROM ' . POSTS_TABLE . ' AS p
                        LEFT JOIN ' . FORUMS_TABLE . ' AS f
                        ON f.forum_id = p.forum_id
                        WHERE ' . $db->sql_build_array('SELECT', array('post_id'    => $event['row']['forum_last_post_id']));
                $result = $db->sql_query($sql);
                $LastPostRow = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);
                $url = $this->generate_topic_link($LastPostRow['forum_id'], $LastPostRow['forum_name'], $LastPostRow['topic_id'], $event['row']['forum_last_post_subject']);

Maybe there is a better way to get the title and ids, but this works for the first.

Rewrite rules on Apache

I have issues with rewrite rules on an apache server.
RewriteRule ^(.)-f([0-9]) viewforum.php?f=$2&%{QUERY_STRING} [L]

I have disabled this rule in my config now. when enabled images links on server do not work (The forum you selected does not exist.)
I guess this rule would rewrite *any url as a viewforum parameter .
removing this rule makes sure it works, need to check if this rule would be required for any special case and if it would break anything?

Problem: Reply with quote

The problem would seem to be due to the fact that sometimes clicking on Reply with quote is not redirected to the root posting.php file, but the category before the file is added ..!

For example, instead of:

website.com/posting.php?mode=quote&f=21&p=16202

You are redirected to:

website.com/category-f1/posting.php?mode=quote&f=21&p=16202

Please, if you do not have time to correct, could you at least tell me which function to check again?
Thanks so much

Rewrite URLs on RSS feeds

Currently the urls will not rewrite on the RSS feeds (feed.php).

A rewrite of the urls would be very useful.

Please add option - simple url

This mod should be able to change url to simple url like: website.com/board/thread/postname
without f-id and post id in url. How to change this?

The problem with Quick Mod Tools (moving topic, etc.)

Hi. There is problem with using quick moderation tools. When you try to move a topic, you get an error of "not safe redirection" or something like that. It should be easy to replicate when you move existing topic to another forum via tools visible in Admins / Global Mods frontend, viewtopic.

post issues (avatar/contact)

me again:)
found another bug:
http://i58.tinypic.com/jv13cg.jpg

idea:
It seems that {postrow.U_POST_AUTHOR} variable from viewtopic.php has wrong value which causes issue with avatar and contact button.

this only happens if u are logged out (guest) - not if u are logged in....

U_NEWEST_POST: link to unread posts goes always to the last site

The greater part of the unread post link (U_NEWEST_POST) works after my PR #36 now.
But now I get always only the unread posts on the last page.
If I have unreaded posts which are not on the last page, I doesn't see them.

I guess we must write a own method for unreaded posts in the base.php.

Error on approve_action in topic view

Because the redirect URL in the parameter on "postrow.U_APPROVE_ACTION" is wrong, an error appears if you approve a topic or post in the topic view.
Current redirect link: ./viewtopic.php?f=10&t=1043&p=10191#p10191
Presumably correct redirect link: ./../viewtopic.php?f=10&t=1043&p=10191#p10191
Or in best case: /news-f10/a-fdf-gdsfh-gffd-sdsf-fdssdf-t1043.html

seourls_error_approve
(demo on my test board)

Anyway to rewrite member profile url?

With phpbb seo there's also the members profiles url that can be rewritten this way :
zeforums.com/nickname-u2.html
instead of zeforums.com//memberlist.php?mode=viewprofile&u=2

Anyway to do this with this extension? It would be a pleasure, as this extension is really lighter than phpbb seo (a lot less files and size), and doesn't write anything in the tables of the database (phpbb seo does), using test page speed in google, it also seems to be a little bit faster than phpbb seo.
Thanks for your answers,

Pierre

Rewrite rules break theme's lightbox

Hi there,

It appears the rewrite rules used in this extension break my theme's lightbox. When the page tries to load "https://cooldown.dev/styles/ravaio/template/lg-fullscreen.min.js?assets_version=41", it returns a 404 error. After disabling the rewrite rule changes again, it resolves itself. Here're the rules I have:

RewriteBase /
RewriteRule ^(.*)-f([0-9]*)/mcp.php(.*) mcp.php?%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)-f([0-9]*)/(.*)-t([0-9]*)-s([0-9]*).html viewtopic.php?f=$2&t=$4&start=$5&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/(.*)-t([0-9]*).html viewtopic.php?f=$2&t=$4&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/index-s([0-9]*).html viewforum.php?f=$2&start=$3&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/ viewforum.php?f=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*) viewforum.php?f=$2&%{QUERY_STRING} [L]

I'm not entirely sure which rule is breaking it, but it seems like it might be from adding "?assets_version=41" to the end of it. Any tips / suggestions would be appreciated. Thanks!

Breadcrumb broken in phpBB3.3

It seems phpBB3.3 uses some different markers for the breadcrumbs. When you inspect the generate_forum_nav function you will see that the navlinks_parents event no longer has a FORUM_NAME, it has been changed to BREADCRUMB_NAME.

Sitemap

{board_url}/app.php/seositemap.xml does not seem to be working for me.

Breaks "Return to the previous page"

My setup is domain.com/subfolder/forum. Everything else is working great so far, but when I hit a redirect page, such as the one you get after authorizing a post, the auto redirect and link sends me back a folder level too far i.e. -

domain.com/subfolder/thread-slug.html?p=5#p5 and not domain.com/subfolder/forum/thread-slug.html?p=5#p5

Thus returning error / 404. Any workarounds?

Attachment filetype images are broken

The attachment filetype images are broken due to looking for them in ./images (by default).

I wrote a terrible fix for it (which has issues):
'core.parse_attachments_modify_template_data' => 'parse_attachments_modify_template_data',

	/**
	 * Correct the path of attachment images
	 *
	 * @param	object	$event	The event object
	 * @return	null
	 * @access	public
	 */
	public function parse_attachments_modify_template_data($event)
	{
		$loc = $this->request->server('REQUEST_URI');
		if (!strpos($loc, 'viewtopic'.$this->php_ext)) {
			$block_array = $event['block_array'];
			$block_array['UPLOAD_ICON'] = str_replace('img src=".', 'img src="..', $block_array['UPLOAD_ICON']);
			$event['block_array'] = $block_array;
		}
	}

Url pagination problem of the topics with phpbb 3.3.8 and php 7.4, 8.0 and 8.1

Hi, with php 8.0 or 8.1, when there is a second page for a topic, the link becomes :
my-topic.html?start=10 instead of my-topic.html-s10.html, and then if we click on the "1" to come to the first page of the topic, the link is now viewtopic.php?t=x like there's no rewrite, but in source code, the canonical url is still my-topic.html.
Any way to fix this?
This fix for php 8.0 doesn't fix this problem (and doesn't cause the problem too, i've tried with the fix and without the fix, same problem) :
#74
Thanks for your answers,

Pierre

Shadow topics don't work when clicked via forum view

Basically a post that has been moved as a shadow topic has the wrong ID when you try to access it via the forum view.

It seems phpBB creates a new ID for the shadow link.

I would hope phpBB says if it's a shadow topic, with the correct ID and it's just a simple bit of detection if this is the case.

I'll take a look and make a PR at some point, but if someone wants to investigate it in the mean time, feel free ;)

Nice to have: rendered redirect URL

Some templatesets (like Metro) use a popup to login. This means the redirect URL in the template variable S_LOGIN_REDIRECT will be filled with the current URL when you are reading a thread in viewtopic.php. This works perfectly without SEOUrls enabled, but it breaks when you use this extension (probably because phpBB doesn't "see" the topic ID).

A simple fix is to add this to listener.php:

'S_LOGIN_REDIRECT' => append_sid($this->base->generate_topic_link($event['forum_id'] , $data['forum_name'], $event['topic_id'], $data['topic_title'], $event['start'])),

Maybe this can be added in a future release?

Yaml error in phpBB3.3.x

Installing this extension gives an error in phpBB3.3.0:

The file "/data/www/avrotros.nl/opgelicht/phpBB3.3.0/ext/tas2580/seourls/config/services.yml" does not contain valid YAML: The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 5 (near "- @auth").

Fix: quotes around the arguments.

utf in link

i try many way bot doent work

i want add arabic litter in link ((UTF-8))

how fix i htacess

RewriteRule ^(.*)-f([0-9]*)/mcp.php(.*) mcp.php?%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)-f([0-9]*)/(.*)-t([0-9]*)-s([0-9]*).html viewtopic.php?f=$2&t=$4&start=$5&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/(.*)-t([0-9]*).html viewtopic.php?f=$2&t=$4&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/index-s([0-9]*).html viewforum.php?f=$2&start=$3&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/ viewforum.php?f=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*) viewforum.php?f=$2&%{QUERY_STRING} [L]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.