URL REwrite fox xoops

只写了news,tag,newbb,profile,extgallery这几个模块!
需要apache 的 Rewrite module 的支持!

1,将.htaccess,rewrite_url.php 两个文件复制到xoops主目录下.
2,如果你的xoops不是您网站的根目录,请按照一下操作,否则,请跳过此条,直接进行第3条!
如果您的网站类似这个url http://www.xxx.com/xoops 的话,请打开.htaccess ,找到
#RewriteBase ,去掉前面的# ,后面加上 /xoops, 使之成为RewriteBase /xoops ,保存
3,打开mainfile.php,找到
define(“XOOPS_CHECK_PATH”, 0);
在其下面添加 include “rewrite_url.php”;
4,清除缓存,刷新即可!

附帖子地址:http://xoops.org.cn/modules/newbb/viewtopic.php?topic_id=20353

.htaccess

RewriteEngine On

#如果你的xoops不是在网站根目录,请填写目录名,比如:
#http://xx.com/xoops ,那么请将#RewriteBase前的#去掉,并且,改为 RewriteBase /xoops ,如果是根目录,请保持不变

#RewriteBase 

#RewriteCond %{REQUEST_FILENAME}   !-f

#all
RewriteRule ^(profile|pm|news|gamaps|extgallery|contact)/index.html$ modules/$1/index.php

#profile
RewriteRule ^profile/([a-zA-Z_-]+).html$ modules/profile/$1.php
RewriteRule ^profile/userinfo.php.*$ modules/profile/userinfo.php$1
RewriteRule ^profile/([0-9]+).html$ modules/profile/userinfo.php?uid=$1
RewriteRule ^profile/edit-([0-9]+).html$ modules/profile/edituser.php?uid=$1

# newbb
RewriteRule ^newbb/forum-(d+).html$ modules/newbb/viewforum.php?forum=$1
RewriteRule ^newbb/rss-(d+).html$ modules/newbb/rss.php?f=$1
RewriteRule ^newbb/thread-(d+)-(d+).html$ modules/newbb/viewtopic.php?topic_id=$1&forum=$2
RewriteRule ^newbb/thread-(d+)-(d+)-(w*)-(ASC|DESC)-(next|prev).html$ modules/newbb/viewtopic.php?viewmode=$3&order=$4&topic_id=$1&forum=$2&move=$5
RewriteRule ^newbb/index-(d+).html$ modules/newbb/index.php?cat=$1
RewriteRule ^newbb/(w+).php.*$ modules/newbb/$1.php$2

#news
RewriteRule ^news/(d+).html$ modules/news/article.php?storyid=$1
RewriteRule ^news/index-(d+).html$ modules/news/index.php?storytopic=$1
RewriteRule ^news/index-(d+)-(d+).html$ modules/news/index.php?storytopic=$1&start=$2
RewriteRule ^news/ratenews-(d+).html$ modules/news/ratenews.php?storyid=$1
RewriteRule ^news/comment-(w*)-(d+)-(d+).html$ modules/news/comment_new.php?com_itemid=$2&com_order=$3&com_mode=$1

#extgallery
RewriteRule ^extgallery/index-(d+).html$ modules/extgallery/public_album.php?id=$1
RewriteRule ^extgallery/index-(d+)-(d+).html$ modules/extgallery/public_album.php?id=$1&start=$2
RewriteRule ^extgallery/photo-(d+).html(#?[a-zA-Z0-9]*)$ modules/extgallery/public_photo.php?photoId=$1$2
RewriteRule ^extgallery/userphoto-(d+).html(#?[a-zA-Z0-9]*)$ modules/extgallery/public_userphoto.php?photoId=$1$2
RewriteRule ^extgallery/rate-(d+)-(d+).html$ modules/extgallery/public_rating.php?id=$1&rate=$2
RewriteRule ^extgallery/useralbum-(d+).html$ modules/extgallery/public_useralbum.php?id=$1
RewriteRule ^extgallery/download-(d+).html$ modules/extgallery/public_download.php?id=$1
RewriteRule ^extgallery/sendecard-(d+).html$ modules/extgallery/public_sendecard.php?id=$1

rewrite_url.php

<?php
// $Id: rewrite_url.php,v 1.0 2009-3-16 cfc4n $
// <http://www.xoops.org.cn>
//
if (!defined("XOOPS_ROOT_PATH") || !defined("XOOPS_URL") ) {
    exit();
}
######################################
#正则表达式里好多代码都被高亮插件执行了,大家还是下载附件吧#
######################################

附件:xoops-rewrite-url

您可能喜欢下面几篇博文

发表评论

3 Comments.

  1. 代码乱了! ([\'\"]{0,1} 都被转义成(['"]{0,1} 了!! 汗,大家还是下载附件吧!

  2. 强大
    下载下来看看!

  3. 2楼的是哪位????

Leave a Reply



[ Ctrl + Enter ]

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

CNXCT小组的博客 is Stephen Fry proof thanks to caching by WP Super Cache