alfred
Administrator
Gepostet am:25.03.2009 18:03
#16
das ist der Text der Seite
Aw:: myalbums 2.88 - Klonen
25.03.2009 18:03 Zitat:The xoRewriteModule makes it possible to rewrite XOOPS URLs. It is not a real module and its installation is quite different from the way XOOPS modules are usually installed. This howto describes how to install it. How to rewrite URLs with the xoRewriteModule in XOOPS: Important issues before you start Before you start: - back up your website! - check if you have an Apache webserver with mod_rewrite enabled as this is required. Getting the files Download the module from this location by clicking on "Téléchargez maintenant". Extract it. Define the modules of which you will rewrite the URLs For the purpose of simplicity, let's assume that you only want to rewrite the URLs of the module "tag" from yoursite/modules/tag/ to yoursite/tags/. You need to edit the file /configs/xoRewriteModule.ini.php. Change: [xoRewriteModule] news="actualite" newbb="forum" wfdownloads="telechargement" smartpartner="partenaires" sitemap="plandusite" formulaire="contact" rss="filrss" extgallery="galerie" in [xoRewriteModule] tag="tags" * news="actualite" * newbb="forum" * wfdownloads="telechargement" * smartpartner="partenaires" * sitemap="plandusite" * formulaire="contact" * rss="filrss" * extgallery="galerie" The line tag="tags" defines the new URL of the tag module, by commenting the other lines the other modules are not affected. You need to change this file again if you want to rename these modules another time, but for the purpose examplification, rewriting the URLs of the tag module will do. Send the files to your server FTP the files to your server. The three folders should be FTP-ed to the root of your site. This will only add the contents of these folders to your current files, not overwrite the folders. Edit yoursite/header.php You need to edit your header.php file in the root of your XOOPS site to add these lines: //xoRewritemodule $xoopsTpl =& $xoTheme->template; $xoopsTpl->load_filter('output', 'xoRewriteModule'); I added these lines just before these two lines $xoopsLogger->stopTime( 'XOOPS output init' ); $xoopsLogger->startTime( 'Module display' ); and it worked well. Rewrite URLs in .htaccess Next step is editting your .htaccess file. The previous steps ensured that XOOPS recognises your new URLs, this step is the actual URL rewriting. If there isn't an .htaccess file, create one. Merge the following lines with your .htaccess file: RewriteEngine On RewriteRule ^tags/(.*) /modules/tag/$1 [QSA,L] The second line rewrites the URLs for the tags module, make simular changes for other modules. Redirect old pages with PHP At this moment, every thing should be working. The URLs are rewritten and the internal links in XOOPS refer to the new, rewritten URLs. However, the old URLs are still working as well and these are probably indexed by search engines. To avoid duplicate content, you need to 301-redirect these to their new location. A 30-redirect is a signal for browsers and search engines that your files are on a new location. Unfortunately, you can't do this in .htaccess as you will create an infinite loop. For this reason, you need to do this in php. Add the following code to yoursite/modules/tag/header.php: if(strpos(getenv('REQUEST_URI'), '/modules/tag/') === 0) { $oldurl = getenv('REQUEST_URI'); $newurl = str_replace("modules/tag", "tags", $oldurl); header("HTTP/1.1 301 Moved Permanently"); header("Location: $newurl"); } just below: http://www.xoops.org/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @author Taiwen Jiang (phppp or D.J.) <php_pp@hotmail.com> * @since 1.00 * @version $Id$ * @package module::tag */ That's it: your URLs are rewritten and your old pages are redirected to the new ones.