Author: Trotter E-mail: trotter@kekerde.net Source: http: //www.gbunix.com/article/article.php/515 reproduced, please keep the document intact, indicate the source. Preface As the content of the Internet is increasingly highlighting the importance of search engines, if the website wants to be better subject to search engines, the website design except for users friend friend, search engine friendly The design of Search Engine Friendly is also very important. The more the page you enter the search engine, the greater the chance to find by the user with different keywords. Have to admit that the dynamic web link ReWrit is a static link is the most insurance and stable search engine optimization. The program is proposed for the URL redirection of the PHPBB forum system. Solution URL redirection From technology, it can be implemented in two ways, one is based on the URL REWRITE, and the other is based on PATH_INFO. For example, http://www.gbunix.com/bbs/ftopic102.html is based on the REWRITE implementation, and http://www.gbunix.com/Article/Article.php/515 is based on PATH_INFO. In response to the transformation of the PHPBB Forum, we have introduced them separately from these two technologies.
I. Using the REWRITE Technology: Modify PHPBB Code: Open / Includes/page_Header.php File, Search Code: // // Generate Logged In / Logged Out Status // Plus: OB_Start (); Function Replace_for_Mod_rewrite (& $ S) {$ urlin = array ("< SQL_Close (); after add: $ contents = ob_get_contents (); ob_end_clean ();
Echo replace_for_mod_rewrite ($ contents); Global $ dbg_starttime; if your phpbb is a 2.06 version, open includees / functions.php file, search code: if (! EMPTY ($ dB)) {$ dB-> SQL_Close ();} Plus: IF (Stristr ($ URL, 'HTTP: / /')) {header ('location:'. $ URL); EXIT;} Finally established .htaccess file in the BBS directory, the file content is: RewriteEngine on shutriterule ^ Forums. * index.php shutriterule ^ forum ([0-9] *). * ViewForum.php? f = $ 1 & mark = Topic Rewriterule ^ Viewforum ([0-9] *) - ([0-9] *) - ([0-9] *). * ViewForum.php? F = $ 1 & TopicDays = $ 2 & Start = $ 3 REWRITERULE ^ Forum ([0-9] *). * ViewForum.php? F = $ 1 REWRITERULE ^ Ptopic ([0- 9] *). * Viewtopic.php? T = $ 1 & view = previous retwriterule ^ NTOPIC ([0-9] *). * Viewtopic.php? T = $ 1 & view = next riterule ^ ftopic ([0-9] *) - ([0-9] *) - ([A-ZA-Z] *) - ([0-9] *). * Viewtopic.php? T = $ 1 & postDays = $ 2 & postorder = $ 3 & Start = $ 4 REWRITERULE ^ ftopic ([0-9] *) - ([0-9] *). * Viewtopic.php? T = $ 1 & start = $ 2 REWRITERULE ^ ftopic ([0-9] *). * Viewtopic.php? T = $ 1 REWRITERULE ^ ftopic ([0-9] *). html viewtopic.php? t = $ 1 & start = $ 2 & postDays = $ 3 & postorder = $ 4 & highlight = $ 5 REWRITERULE ^ SUTRA ([0-9] *). * Viewtopic.php? P = $ 1 If your server does not support .htaccess, open the httpd.conf file, edit your virtual host part, as follows:
$ 1 REWRITERULE ^ / BBS / PTOPIC ([0-9] *). * /Bbs/viewtopic.php?t=1&view=previous Rewriterule ^ / BBS / NTOPIC ([0-9] *). * / BBS / ViewTopic .php? t = $ 1 & view = next riterule ^ / bbs / ftopic ([0-9] *) - ([A-ZA-Z] *) - ([0-9] *). * /bbs/viewtopic.php?t= $ 1&postdays= $ 2&postorder= $ 3&Start= $4 Rewriterule ^ / BBS / FTOPIC ([0-9] *) - ([0-9] *). * / bbs /viewtopic.php?t= $1&Start= $2 REWRITERULE ^ / BBS / FTOPIC ([0-9] *). * /bbs/viewtopic.php?t=1 shutrole ^ / bbs / ftopic ([0-9] * ) .html /bbs/viewtopic.php?t= $ 1&Start= $ 2&postdays= $ 3&postorder= $ 5 REWRITERULE ^ / BBS / SUTRA ([0-9] *). * /bbs/viewtopic.php?p = $ 1 ERRORLOG logs / gbunix.com-error_log customer omlog logs / gbunix.com-access_log combined virtualhost> If you are not a virtual host, put the REWRITERULE section of the code in the httpd.conf file. Note: Very important point, for the system security, please establish the robots.txt file in the BBS publishing directory, the file content is as follows: Disllow: /your-forum-folder/sutra*.html $ DISALLOW: / Your-Forum-Folder /ptopy.html $ DISALLOW: /YOOUR-forum-folder/NTopic*.html $ DISALLOW: /YOUR-forum-folder/ftopic*asc*.html $ Add MOD_REWRITE Module If your server Apache has not been installed, That is very simple, compiling the Mod_rewrite module when compiling Apache, the relevant documentation can be found in www.gbunix.com. If your apache is already installed, just want to compile the mod_rewrite.so module, loaded in Apache, and we will introduce this method. Examples of Solaris operating systems: # Path = / usr / local / bin: / usr / sfw / bin: / usr / ccs / bin: $ path # export path # which gcc # which make # Find ./Name MOD_REWRITE. c // Looking for MOD_REWRITE.C files in Apache's installation directory # CD path / to / mod_rewrite.c // Enter the directory containing the mod_rewrite.c file # apxs -c mod_foo.c // apxs Please specify an absolute path, in you Currently in bin directory in Apache # apxs -i -a -n mod_rewrite mod_rewrite.la If there is no error, you should compile a mod_rewrite.so file in your Apache's modules directory.
Edit the httpd.conf file, confirm that httpd.conf already contains MOD_REWRITE.SO's loading statement, as follows: loadModule Rewrite_Module Modules / Mod_rewrite.so At this time, your Apache should have supported REWRITE.
II. Based on PATH_INFO Technology: Modify PHPBB Code: Open Overall_Header.tpl file, add the following code in the first line: