Kod: Tümünü seç
## Author Notes:
## _____________
##
## This is the phpBB SEO Advanced mod_rewrite core.
## Please note that this version will not inject topic titles in post's URLS. This is to make it easier
## to disallow them with our robots.txt file, since these are duplicates any way.
##
## You can insall the No Duplicate mod ( http://www.phpbb-seo.com/boards/advanced-seo-url/advanced-phpbb3-seo-url-vt1219.html )
## if you want to replace post URL with their corresponding topic URL.
##
## This mod requires running Apache Server with mod_Rewrite module loaded, or IIS server running isapi_rewrite.
##
## This mod no longer requires any other SID removal method, phpBB is doing it by itself as long as you set it up properly.
##
## With this mod, phpBB URL will transformed this way :
##
## viewforum.php?f=xx => any-keywords-fxx.html (by default),
## any-keywords-fxx/ (optional),
## any-keywords/ (optional)
##
## viewforum.php?f=xx&start=yy => any-keywords-fxx-yy.html (by default),
## any-keywords-fxx/pageyy.html (optional),
## any-keywords/pageyy.html (optional)
##
## viewtopic.php?f=xx&t=yy => topic-title-tyy.html (by default),
## any-keywords-fxx/topic-title-tyy.html (optional),
## any-keywords/topic-title-tyy.html (optional)
##
## viewtopic.php?f=xx&t=yy&start=zz => topic-title-tyy-zz.html (by default),
## any-keywords-fxx/topic-title-tyy-zz.html (optional),
## any-keywords/topic-title-tyy-zz.html (optional),
## topic-title-tyy/pagezz.html (optional),
## any-keywords-fxx/topic-title-tyy/pagezz.html (optional),
## any-keywords/topic-title-tyy/pagezz.html (optional)
##
## viewtopic.php?p=xx => postxx.html (by default)
##
## memberlist.php?mode=viewprofile&u=xx => memberxx.html (by default),
## nickname-uxx.html (optional),
## member/nickname (optional)
##
## memberlist.php?mode=group&g=xx => groupxx.html (by default),
## groupe-name-gxx.html (optional)
##
## memberlist.php?mode=group&g=xx&start=yy => groupxx-yy.html (by default),
## groupe-name-gxx-yy.html (optional),
## groupxx/pageyy.html (optional),
## groupe-name-gxx/pageyy.html (optional)
##
## memberlist.php?mode=leaders => the-team.html (by default)
##
## search.php?author_id=xx&sr=post => messagesxx.html (Optional),
## nickname-mxx.html (optional),
## messages/nickname/ (optional)
##
## search.php?author_id=xx&sr=post&start=yy => messagesxx-yy.html (Optional),
## nickname-mxx-yy.html (optional),
## messages/nickname/pageyy.html (optional)
##
## If the virtual folder is turned on, global announces will be treated in a separate virtual folder :
##
## viewtopic.php?f=xx&t=yy => announces/announces-title-tyy.html
##
## viewtopic.php?f=xx&t=yy&start=zz => announces/announces-title-tyy-zz.html
##
## This mod has nothing in common with other phpBB mod rewrite, it will perform the URL rewriting
## without using ob_start() nor adding any SQL. It is thus faster and not messing anymore with Gun-Zip
## or with the html link format, and will not output any pagination duplicates.
##
## The process is optimized, titles and URLs are transformed once, even if the url is called and outputted many times.
##
## WARNING : Topic title injection in URL can be hard to deal with depending on the type of subjects your
## forum is about. In most cases phpBB SEO recommend the use of the phpBB SEO mixed mod Rewrite instead.
## Please read : http://boards.phpbb-seo.com/phpbb-seo-toolkit/phpbb-seo-mod-rewrites-vt66.html
##
## This mod is and will be compatible to all phpBB SEO modules, specific install instructions may apply.
## phpBB SEO will provide patches to allow for other URL standards support upon request,
## so that everyone can take advantage of the phpBB mod Rewrites enhancement without jeopardising his Page-Ranking.
##
##
## Char-sets :
## ___________
##
## phpBB3 uses UTF-8 as final encoding, and this should be enough to handle all cases.
## UTF-8 is fully supported by this mod.
## The mod rewrite will only inject the ASCII Chars ( after removing all accents ) available in the titles.
##
## For example : "[non ASCII chars] Software niño" will be formated this way prior to injection : "software-nino".
## It is still possible that some characters only having a decimal HTML/XML entity won't be handled properly at first.
## The method to filter these is simple, please ask for help in our forums.
##
## Migration :
## ___________
##
## If you are migration, eg if your forum is already indexed using different URLs,
## you'll have to use another robots.txt and install the zero duplicate.
## The migrating procedure will allow you to migrate and keep your previously indexed pages.
## Older links will be HTTP 301 redirected to the new ones. It is rather simple, but the solution depends on cases.
## Let's meet in the Advanced mod rewrite forum ( http://www.phpbb-seo.com/boards/advanced-seo-url-vf54/ ).
##
##
#### UPDATE
## 0.4.0RC4 => 0.4.0 Update : Required changes to be found in contrib/0.4.0RC4_0.4.0_Advanced_Update.txt
## Previous updates are to be found in the contrib/old/ folder.
####
##
##
#
#-----[ DIY INSTRUCTIONS ]--------------------------------------------------
#
________________________________________
>>>> INSTALLATION INSTRUCTION <<<<<
________________________________________
You will find the premodded phpBB 3.0.0 files in contrib/phpBB_3.0.0_modified_files/root/,
you can safely overwrite the phpBB 3.0.0 files with these and skip the file editing part of this install
if you did not modify these before you install this mod.
Additional language files modified by this mod are to be found in
contrib/phpBB_3.0.0_modified_files/translations/.
A phpBB 3.0.0 => advanced mod rewrite 0.4.0 diff file is as well available in the
contrib/ directory of this release.
___________
IMPORTANT :
________________________________________
Before you start, read this with caution.
=> For a smooth install :
1) Backup all your files;
2) Apply the mod code changes on copies of your files;
3) Upload all files;
4) CHMOD the phpbb_seo/cache/ folder to 0777;
5) Empty the phpBB/cache/ folder : just delete all files EXCEPTS the .htaccess.
6) Go to www.yoursite.com/phpBB/phpbb_seo/phpbb_seo_install.php and follow the install instruction
7) Go to phpBB ACP : It's now time to play with settings described bellow;
8) Generate your personalized .htaccess and upload or move it following the instructions;
9) Test a rewritten URL, such as www.yoursite.com/phpBB/post1.html, if you end up with a 404 (not a phpBB message), go back to step 8;
10) Activate URL rewriting in phpBB ACP and allow yourself some auto-congratulation :D
________________________________________
Once you will have installed the mod, you will have to refresh your theme's cache as well as phpBB's cache (ACP => STYLE, Themes => Refresh).
__________
Settings :
__________
The settings must be done before step 7 above for the generated .htaccess to be up to date.
Later modification will most likey require a new .htaccess as well as personalized redirections.
=> By Default, this mod will get rid of index.php for phpBB's index.
You can change this in phpbb_seo/phpbb_seo_class.php if you prefer.
Look for :
'index' => ''
And replace with :
'index' => 'forum'
or whatever you may prefer.
This is mostly useful if you're running a portal in the folder where phpBB is installed.
=> The first setting to do is to select which static part to use in your URLs.
To do so, you can modify this in phpbb_seo/phpbb_seo_class.php :
=> the-team :
'leaders' => 'the-team'
=> announces :
'global_announce' => 'announces'
=> As well as forum ('forum' => 'forum'), topic ('topic' => 'topic'), post ('post' => 'post'),
member ('user' => 'member'), groups ('group' => 'group'), User message pages ('usermsg' => 'messages')
and virtual folder pagination ('pagination' => 'page')
=> And the suffixes, if you don not like .html :
$this->seo_ext = array( 'forum' => '.html', 'topic' => '.html', 'post' => '.html', 'user' => '.html', 'usermsg' => '.html', 'group' => '.html', 'index' => '', 'global_announce' => '/', 'leaders' => '.html', 'pagination' => '.html', 'gz_ext' => '');
Please note that suffixes may not be ".php" or empty.
This settings will be taken into account while generating the .htaccess.
=> Other options are configurable on the setting page (step 7 of the above list).
Go to the "phpBB SEO Class Settings" page, and take your time to set up the class as you whish.
=> It is now time to play with your forum URLs.
To do so, go to the "Forum URL management" page and start selecting good keywords for your forum URLs.
Take your time to do it, and remember that using the remove IDs option in the settings makes it a bit harder to build appropriate redirection, in case you edit the forum URLs later.
If you later create more forums, you'll just have to go to this page again an eventually update the
new forum URL.
If not, the new forum URL will not be cached and the default one will be used (forum-title-fxx).
___________
NOTE: Cache
___________
The cache files are in the phpbb_seo_/cache/ folder.
phpbb_cache.php is the cached file containing both your settings and forum URLs.
The mod always creates a backups of the current cached file :
=> phpbb_cache.php.current is a copy of the phpbb_cache.php file.
It will automatically be used in case phpbb_cache.php is deleted or corrupted (which should not occur but).
=> phpbb_cache.php.old is a copy of the previous settings you had set, before the last update you performed.
You should backup these file when you update them, they are as crucial as you data base for your forum
since they are required for your forum URL to work properly.
So relax, this is just a basic precaution, you should not have trouble with these,
but never is better, hence the backup.
_________________
NOTE: .htaccess :
_________________
On the phpBB SEO ACP module, go to the ".htaccess" page.
A personalised .htaccess will be generated. It's the first one to consider trying.
If the default suggestion does not work, you will be to try more options, and generate several alternative.
You'll find an empty .htaccess file in this mod's archive contrib/ folder, you can use it to paste the .htaccess content generated on the htaccess page or save it directly on the server.
Please take a look at : http://www.phpbb-seo.com/boards/seo-principles/locking-the-www-in-urls-vt30.html
to find out how to lock the use (or un use) of the www prefix in your domain's url.
This is a major Search Engine Optimisation issue to take care of the www prefix issue.
__________________
NOTE: robots.txt :
__________________
You will find a sample robots.txt file in the contrib/ folder of this package.
The robots.txt file must be uploaded in your domain's root folder (can be different from the phpBB one).
You must obviously replace phpbb/ with your real phpBB installation folder (or with nothing if it's installed in the domain's root).
__________________________________________________
NOTE: profile and user messages pages ID removing:
__________________________________________________
phpBB/member/nicknames VS phpBB/nicknames-uxx.html And phpBB/messages/nicknames VS dephpBB/nicknames-mxx.html
If you use profile and / or user messages pages ID removing, you should know that some urlencode
will be used by some browsers such as Firefox.
As well, a bug with mod_rewrite requires some custom url encoding to handle the "&" case proper in user names.
For example a user named rock&roll will require rock%2526roll (double urlencoded &) to be usable.
( http://www.php.net/urlencode => http://issues.apache.org/bugzilla/show_bug.cgi?id=34602 )
There are other issues with custom characters, like accents, which will add some urlencoded chars in urls.
It's not an SEO issue, since bots knows about urlencoding, but it can end up building pretty long url with multi byte characters.
This does not concern the a-zA-Z0-9 chars, underscore ("_"), hyphen ("-") and dot (".") included.
In phpbb_seo/phpbb_seo_class.php, you can decide to use different methods :
$this->seo_opt['custom_url_endode'] = 1;
You can change the value, to 1, 2 and 3.
$this->seo_opt['custom_url_endode'] = 1, nickname is pretty much injected as is, after it is
htmlspecialchars_decoded, encoded in UTF-8 and filtered for the "&" case.
This means you will let the browser decide, FF will most likely use urlencoded chars
if your user are using more than alphanumeric chars, but IE and Opera should do the trick.
$this->seo_opt['custom_url_endode'] = 2, would mean to impose urlencoding on all links, with the double urlencoding trick on "&".
Should handle more special cases, but imposes urlencoding for all browsers.
$this->seo_opt['custom_url_endode'] = 3, double urlencode everything, most likely the safest way for desperate cases :-D
Should handle pretty much all cases, but imposes double urlencoding for all browsers.
This of course means that the ID removing on profile and user messages pages is more comfy and universally efficient
to use with alphanumeric chars user names (without accents).
Other cases are heavier and are more meant to handle few exceptions than to do the trick with multi byte chars in general.
Here, it's mostly Firefox to limit us a bit.
If you only allow alphanumeric chars for your user nicknames, then you can make the injection process faster by adding :
return $url;
right after :
function seo_url_encode( $url, $type = 1 ) {
Remember that keeping the ID here will always work.
#