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

关注微信公众号,手机阅读更方便: 程序员的阅微草堂

知识共享许可协议莿鸟栖草堂CFC4N 创作,采用 知识共享 署名-非商业性使用-相同方式共享(3.0未本地化版本)许可协议进行许可。基于http://www.cnxct.com上的作品创作。转载请注明转自:URL REwrite fox xoops

6 thoughts on “URL REwrite fox xoops

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据