17

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

  1. RewriteEngine On
  2.  
  3. #如果你的xoops不是在网站根目录,请填写目录名,比如:
  4. #http://xx.com/xoops ,那么请将#RewriteBase前的#去掉,并且,改为 RewriteBase /xoops ,如果是根目录,请保持不变
  5.  
  6. #RewriteBase
  7.  
  8. #RewriteCond %{REQUEST_FILENAME}   !-f
  9.  
  10. #all
  11. RewriteRule ^(profile|pm|news|gamaps|extgallery|contact)/index.html$ modules/$1/index.php
  12.  
  13. #profile
  14. RewriteRule ^profile/([a-zA-Z_-]+).html$ modules/profile/$1.php
  15. RewriteRule ^profile/userinfo.php.*$ modules/profile/userinfo.php$1
  16. RewriteRule ^profile/([0-9]+).html$ modules/profile/userinfo.php?uid=$1
  17. RewriteRule ^profile/edit-([0-9]+).html$ modules/profile/edituser.php?uid=$1
  18.  
  19. # newbb
  20. RewriteRule ^newbb/forum-(d+).html$ modules/newbb/viewforum.php?forum=$1
  21. RewriteRule ^newbb/rss-(d+).html$ modules/newbb/rss.php?f=$1
  22. RewriteRule ^newbb/thread-(d+)-(d+).html$ modules/newbb/viewtopic.php?topic_id=$1&forum=$2
  23. 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
  24. RewriteRule ^newbb/index-(d+).html$ modules/newbb/index.php?cat=$1
  25. RewriteRule ^newbb/(w+).php.*$ modules/newbb/$1.php$2
  26.  
  27. #news
  28. RewriteRule ^news/(d+).html$ modules/news/article.php?storyid=$1
  29. RewriteRule ^news/index-(d+).html$ modules/news/index.php?storytopic=$1
  30. RewriteRule ^news/index-(d+)-(d+).html$ modules/news/index.php?storytopic=$1&start=$2
  31. RewriteRule ^news/ratenews-(d+).html$ modules/news/ratenews.php?storyid=$1
  32. RewriteRule ^news/comment-(w*)-(d+)-(d+).html$ modules/news/comment_new.php?com_itemid=$2&com_order=$3&com_mode=$1
  33.  
  34. #extgallery
  35. RewriteRule ^extgallery/index-(d+).html$ modules/extgallery/public_album.php?id=$1
  36. RewriteRule ^extgallery/index-(d+)-(d+).html$ modules/extgallery/public_album.php?id=$1&start=$2
  37. RewriteRule ^extgallery/photo-(d+).html(#?[a-zA-Z0-9]*)$ modules/extgallery/public_photo.php?photoId=$1$2
  38. RewriteRule ^extgallery/userphoto-(d+).html(#?[a-zA-Z0-9]*)$ modules/extgallery/public_userphoto.php?photoId=$1$2
  39. RewriteRule ^extgallery/rate-(d+)-(d+).html$ modules/extgallery/public_rating.php?id=$1&rate=$2
  40. RewriteRule ^extgallery/useralbum-(d+).html$ modules/extgallery/public_useralbum.php?id=$1
  41. RewriteRule ^extgallery/download-(d+).html$ modules/extgallery/public_download.php?id=$1
  42. RewriteRule ^extgallery/sendecard-(d+).html$ modules/extgallery/public_sendecard.php?id=$1

rewrite_url.php

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

附件:xoops-rewrite-url

3 Responses to “URL REwrite fox xoops”

  1. CFC4N

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

  2. yan

    强大
    下载下来看看!

  3. CFC4N

    2楼的是哪位????

Leave a Reply

*
你是机器人吗?如果不是,请填写验证码,谢谢... 如果你看不清,那你点图片,听语音
Click to hear an audio file of the anti-spam word