Xoops URL 重写 | Xoops Mod_Rewrite
让动态页静态显示,心动吧...
下面开始了,一切从简.
Xoops Mod_Rewrite:
大概步骤:
1.你了解APACHE的一般应用操作,请继续看
2.你是服务器管理员,请继续看
3.你有固定IP地址,请继续看
4.你没有固定IP地址,请继续看-_-!!!
5.设置虚拟主机
6.注意事项
7.重写应用,我不会向你解释,也不想解释,Apache的Mod_rewrite不是很容易就可以解释的...
8.修改模板
9.完成
--------------------------------------------------------------------------------
1. 2. 3. 4. 没什么好说的,下面开始设置虚拟主机:
5.
介绍一下(我用的是名称虚拟主机,这个你可以灵活运用_):
混用基于端口和基于IP的虚拟主机 | 混用基于域名和基于ip的虚拟主机
如果您的服务器有两个IP地址(172.20.30.40和 172.20.30.50)分别对应域名 www.example1.com和www.example2.org。对每 个域名,您都希望在80端口和8080端口发布您的网站。您可以这样配置:
服务器配置
Listen 172.20.30.40:80
Listen 172.20.30.40:8080
Listen 172.20.30.50:80
Listen 172.20.30.50:8080
<VirtualHost 172.20.30.40:80>
DocumentRoot /www/example1-80
ServerName www.example1.com
</VirtualHost>
<VirtualHost 172.20.30.40:8080>
DocumentRoot /www/example1-8080
ServerName www.example1.com
</VirtualHost>
<VirtualHost 172.20.30.50:80>
DocumentRoot /www/example2-80
ServerName www.example1.org
</VirtualHost>
<VirtualHost 172.20.30.50:8080>
DocumentRoot /www/example2-8080
ServerName www.example2.org
</VirtualHost>
混用基于域名和基于ip的虚拟主机
如果您想在一些地址上配置基于域名的虚拟主机而在另外一些配置基于 IP的虚拟主机。
服务器配置 Listen 80
NameVirtualHost 172.20.30.40
<VirtualHost 172.20.30.40>
DocumentRoot /www/example1
ServerName www.example1.com
</VirtualHost>
<VirtualHost 172.20.30.40>
DocumentRoot /www/example2
ServerName www.example2.org
</VirtualHost>
<VirtualHost 172.20.30.40>
DocumentRoot /www/example3
ServerName www.example3.net
</VirtualHost>
# IP-based
<VirtualHost 172.20.30.50>
DocumentRoot /www/example4
ServerName www.example4.edu
</VirtualHost>
<VirtualHost 172.20.30.60>
DocumentRoot /www/example5
ServerName www.example5.gov
</VirtualHost>
---------------------------------
下面长下划线内就是设置:
-------------------------------------------------------------------------------------------------------------------------------
#-----------------设置监听端口
Listen 80
Listen 88
Listen 99
Listen 89
UseCanonicalName Off
#-----------------指定虚拟主机--------------(你得根据自己的需要设置)
NameVirtualHost 192.168.1.2:80
NameVirtualHost 192.168.1.2:88
NameVirtualHost 192.168.1.2:99
NameVirtualHost 192.168.1.2:89
#-----------------虚拟主机设置
<VirtualHost *:88>
#-----------------管理员电子邮件
ServerAdmin [email protected]
#-----------------网站主目录
DocumentRoot "I:/gi-2288"
#-----------------网站域名
ServerName gi.2288.org
#-----------------错误日志记录
ErrorLog "G:/Apache/dummy-gi.2288.org.88-error_log"
UseCanonicalName Off
#-----------------虚拟目录设置,并且允许目录浏览
Alias /article "L:/article/"
<Directory "L:/article/">
Options all
AllowOverride all
Order allow,deny
Allow from all
</Directory>
#-----------------虚拟目录设置,不允许目录浏览
Alias /document "L:/Document/"
<Directory "L:/Document/">
Options FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
# --------------------重写开始-----------------重写开始
RewriteEngine On
# --------------------News Modules-----------------重写内容
RewriteRule /modules/news/topic_(.+)\.htm$ /modules/news/index.php?storytopic=$1 [L]
# http://gi.2288.org:88/modules/news/index.php?storytopic=2
# http://gi.2288.org:88/modules/news/topic_2.htm
RewriteRule /modules/news/article_([0-9]+).htm$ /modules/news/article.php?storyid=$1
# http://gi.2288.org:88/modules/news/index.php?storytopic=312
# http://gi.2288.org:88/modules/news/article_312.htm
RewriteRule /modules/news/topic(.*)-(.*)\.htm$ /modules/news/index.php?storytopic=$1&start=$2
# http://gi.2288.org:88/modules/news/index.php?storytopic=312
# http://gi.2288.org:88/modules/news/article_312.htm
RewriteRule /modules/news/archive\.htm$ /modules/news/archive.php
RewriteRule /modules/news/index.htm$ /modules/news/index.php
# --------------------News Modules-----------------重写内容
# --------------------Wfdownloads Modules----------重写内容
RewriteRule /modules/wfdownloads/topic_(.+)\.htm$ /modules/wfdownloads/viewcat.php?cid=$1 [L]
# http://gi.2288.org:88/modules/mydownloads/viewcat.php?cid=9
# http://gi.2288.org:88/modules/mydownloads/topic_9.htm RewriteRule /modules/wfdownloads/topic_o_(.+)\.htm$ /modules/wfdownloads/viewcat.php?op=&cid=$1 [L]
# http://gi.2288.org:88/modules/mydownloads/
# http://gi.2288.org:88/modules/mydownloads/
RewriteRule /modules/wfdownloads/newlist\.htm$ /modules/wfdownloads/newlist.php
RewriteRule /modules/wfdownloads/hit_\.htm$ /modules/wfdownloads/topten.php?list=hit
# http://gi.2288.org:88/modules/wfdownloads/topten.php?list=hit
# http://gi.2288.org:88/modules/wfdownloads/hit.htm
RewriteRule /modules/wfdownloads/rate\.htm$ /modules/wfdownloads/topten.php?list=rate
# http://gi.2288.org:88/modules/wfdownloads/topten.php?list=rate
# http://gi.2288.org:88/modules/wfdownloads/rate.htm
RewriteRule /modules/wfdownloads/index.htm$ /modules/wfdownloads/index.php
RewriteRule /modules/wfdownloads/down(.*)-(.*)\.htm$ /modules/wfdownloads/singlefile.php?cid=$1&lid=$2
# http://gi.2288.org:88/modules/wfdownloads/singlefile.php?cid=4&lid=131
# http://gi.2288.org:88/modules/wfdownloads/down4-131.htm
RewriteRule /modules/wfdownloads/list_(.*)\.htm$ /modules/wfdownloads/viewcat.php?list=$1
# http://gi.2288.org:88/modules/wfdownloads/viewcat.php?list=L
# http://gi.2288.org:88/modules/wfdownloads/list_L.htm
# --------------------Wfdownloads Modules----------重写内容
# --------------------Mydownloads Modules
RewriteRule /modules/mydownloads/index.htm$ /modules/mydownloads/index.php
RewriteRule /modules/mydownloads/topic_(.+)\.htm$ /modules/mydownloads/viewcat.php?cid=$1 [L]
RewriteRule /modules/mydownloads/hit_(.+)\.htm$ /modules/mydownloads/topten.php?hit=$1 [L]
RewriteRule /modules/mydownloads/rate_(.+)\.htm$ /modules/mydownloads/topten.php?rate=$1 [L]
RewriteRule /modules/mydownloads/down(.*)-(.*)\.htm$ /modules/mydownloads/singlefile.php?cid=$1&lid=$2
# --------------------MyAlbum
RewriteRule /modules/myalbum/index.htm$ /modules/myalbum/index.php
RewriteRule /modules/myalbum/hit_(.+)\.htm$ /modules/myalbum/topten.php?hit=1
RewriteRule /modules/myalbum/photo_(.+)\.htm$ /modules/myalbum/photo.php?lid=$1 [L]
# http://gi.2288.org:88/modules/myalbum/photo.php?lid=1532
# http://gi.2288.org:88/modules/myalbum/photo_1532.htm
RewriteRule /modules/myalbum/topic_(.+)\.htm$ /modules/myalbum/viewcat.php?cid=$1 [L]
# http://gi.2288.org:88/modules/myalbum/viewcat.php?cid=48
# http://gi.2288.org:88/modules/myalbum/topic_48.htm
RewriteRule /modules/myalbum/view(.*)-(.*)\.htm$ /modules/myalbum/viewcat.php?num=$1&cid=$2
RewriteRule /modules/myalbum/photo(.*)-(.*)\.htm$ /modules/myalbum/photo.php?lid=$1&cid=$2
# http://gi.2288.org:88/modules/myalbum/photo.php?lid=914&cid=34
# http://gi.2288.org:88/modules/myalbum/photo914-34.htm
# --------------------AMS
RewriteRule /modules/AMS/index.htm$ /modules/AMS/index.php
RewriteRule /modules/AMS/archive.htm$ /modules/AMS/archive.php
RewriteRule /modules/AMS/article_(.+)\.htm$ /modules/AMS/article.php?storyid=$1
# http://gi.2288.org:88/modules/AMS/article.php?storyid=38
# http://gi.2288.org:88/modules/AMS/article_38.htm
RewriteRule /modules/AMS/topic_(.+)\.htm$ /modules/AMS/index.php?storytopic=$1
RewriteRule /modules/AMS/archive(.*)-(.*)\.htm$ /modules/AMS/archive.php?year=$1&month=$2
# --------------------Booklist
RewriteRule /modules/booklists/index.htm$ /modules/booklists/index.php
RewriteRule /modules/booklists/hit_(.+)\.htm$ /modules/booklists/topten.php?hit=$1
RewriteRule /modules/booklists/rate_(.+)\.htm$ /modules/booklists/topten.php?rate=$1
RewriteRule /modules/booklists/view(.*)\.htm$ /modules/booklists/viewcat.php?cid=$1
# --------------------Xphpbbi
RewriteRule /modules/xphpbbi/index.htm$ /modules/xphpbbi/index.php
RewriteRule /modules/xphpbbi/viewforum_(.*)\.htm$ /modules/xphpbbi/viewforum.php?f=$1
RewriteRule /modules/xphpbbi/viewtopic_(.*)\.htm$ /modules/xphpbbi/viewtopic.php?t=$1
RewriteRule /modules/xphpbbi/viewtopic_post(.*)-(.*)-(.*)-(.*)-(.*)\.htm$ /modules/xphpbbi/viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5
RewriteRule /modules/xphpbbi/viewtopic_o(.*)\.htm#(.*)$ /modules/xphpbbi/viewtopic.php?p=$1#$1
# --------------------NewBB
RewriteRule /modules/newbb/index.htm$ /modules/newbb/index.php
RewriteRule /modules/newbb/viewall.htm$ /modules/newbb/viewall.php
# http://gi.2288.org:88/modules/newbb/viewall.php
# http://gi.2288.org:88/modules/newbb/viewall.htm
RewriteRule /modules/newbb/search.htm$ /modules/newbb/search.php
# http://gi.2288.org:88/modules/newbb/search.php
# http://gi.2288.org:88/modules/newbb/search.htm
RewriteRule /modules/newbb/forum_(.*)\.htm$ /modules/newbb/viewforum.php?forum=$1
# http://gi.2288.org:88/modules/newbb/viewforum.php?forum=5
# http://gi.2288.org:88/modules/newbb/forum_5.htm
RewriteRule /modules/newbb/viewtopic_id(.*)-(.*)\.htm$ /modules/newbb/viewtopic.php?topic_id=$1&forum=$2
# http://gi.2288.org:88/modules/newbb/viewtopic.php?topic_id=111&forum=5
# http://gi.2288.org:88/modules/newbb/viewtopic_id111-5.htm
RewriteRule /modules/newbb/topic_mode_(.*)-(.*)-(.*)\.htm$ /modules/newbb/viewtopic.php?viewmode=$1&topic_id=$2&forum=$3
# http://gi.2288.org:88/modules/newbb/viewtopic.php?viewmode=flat&topic_id=111&forum=5
# http://gi.2288.org:88/modules/newbb/topic_mode_flat-111-5.htm
RewriteRule /modules/newbb/newtopic_(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.htm$ /modules/newbb/viewforum.php?start=$1&forum=$2&sortname=$3&sortorder=$4&sortsince=$5&type=$6
# http://gi.2288.org:88/modules/newbb/viewforum.php?start=0&forum=27&sortname=p.post_time&sortorder=DESC&sortsince=100&type=unread
# http://gi.2288.org:88/modules/newbb/newtopic_0-27-p.post_time-DESC-100-unread.htm
RewriteRule /modules/newbb/digest_(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.htm$ /modules/newbb/viewforum.php?start=$1&forum=$2&sortname=$3&sortorder=$4&sortsince=$5&type=$6
# http://gi.2288.org:88/modules/newbb/viewforum.php?start=0&forum=27&sortname=p.post_time&sortorder=DESC&sortsince=100&type=digest
# http://gi.2288.org:88/modules/newbb/digest_0-27-p.post_time-DESC-100-digest.htm
RewriteRule /modules/newbb/unreplied(.*)\.htm$ /modules/newbb/viewall.php?type=$1
# http://gi.2288.org:88/modules/newbb/viewall.php?type=unreplied
# http://gi.2288.org:88/modules/newbb/unrepliedunreplied.htm
RewriteRule /modules/newbb/topic_time_(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.htm$ /modules/newbb/viewtopic.php?viewmode=$1&order=$2&topic_id=$3&forum=$4&move=$5&topic_time=$6
# http://gi.2288.org:88/modules/newbb/viewtopic.php?viewmode=threaded&order=ASC&topic_id=111&forum=5&move=prev&topic_time=1105542643
# http://gi.2288.org:88/modules/newbb/topic_time_threaded-ASC-111-5-prev-1105542643.htm
# --------------------Ipb
RewriteRule /modules/ipboard/index.htm$ /modules/ipboard/index.php
RewriteRule /modules/ipboard/showtopic_(.*)-(.*)\.htm$ /modules/ipboard/index.php?showtopic=$1&s=$2
# http://gi.2288.org:88/modules/ipboard/index.php?showtopic=23&s=8d88e79f2ec22ddc5c84d6414bf6c945
# http://gi.2288.org:88/modules/ipboard/showtopic_23-8d88e79f2ec22ddc5c84d6414bf6c945.htm
RewriteRule /modules/ipboard/showforum_(.*)-(.*)\.htm$ /modules/ipboard/index.php?showforum=$1&s=$2
# http://gi.2288.org:88/modules/ipboard/index.php?showforum=17&s=8d88e79f2ec22ddc5c84d6414bf6c945
# http://gi.2288.org:88/modules/ipboard/showforum_17-8d88e79f2ec22ddc5c84d6414bf6c945.htm
RewriteRule /modules/ipboard/showforum_(.*)\.htm$ /modules/ipboard/index.php?showforum=$1
# http://gi.2288.org:88/modules/ipboard/index.php?showforum=14
# http://gi.2288.org:88/modules/ipboard/showforum_14.htm
RewriteRule /modules/ipboard/showtopic_(.*)\.htm$ /modules/ipboard/index.php?showtopic=$1
# http://gi.2288.org:88/modules/ipboard/index.php?showtopic=17
# http://gi.2288.org:88/modules/ipboard/showtopic_17.htm
RewriteRule /modules/ipboard/act_(.*)-(.*)\.htm$ /modules/ipboard/index.php?act=$1&c=$2
# http://gi.2288.org:88/modules/ipboard/index.php?act=SC&c=4
# http://gi.2288.org:88/modules/ipboard/act_SC-4.htm
RewriteRule /modules/ipboard/act-i_(.*)\.htm$ /modules/ipboard/index.php?act=$1
# http://gi.2288.org:88/modules/ipboard/index.php?act=idx
# http://gi.2288.org:88/modules/ipboard/act-i_idx.htm
# --------------------Digest
RewriteRule /modules/digest/index.htm$ /modules/digest/index.php
RewriteRule /modules/digest/cid_(.*)\.htm$ /modules/digest/index.php?category_id=$1
# http://gi.2288.org:88/modules/digest/index.php?category_id=2
# http://gi.2288.org:88/modules/digest/cid_2.htm
RewriteRule /modules/digest/ud_(.*)-(.*)\.htm$ /modules/digest/index.php?op=$1&digest_id=$2
# http://gi.2288.org:88/modules/digest/index.php?op=update&digest_id=7
# http://gi.2288.org:88/modules/digest/ud_update-7.htm
RewriteRule /modules/digest/ctid_(.*)\.htm$ /modules/digest/custom.php?category_id=$1
# http://gi.2288.org:88/modules/digest/custom.php?category_id=2
# http://gi.2288.org:88/modules/digest/ctid_2.htm
RewriteRule /modules/digest/u-ccid_(.*)\.htm$ /modules/digest/index.php?digest_id=$1
# http://gi.2288.org:88/modules/digest/index.php?digest_id=10#10&
# http://gi.2288.org:88/modules/digest/u-ccid_10.htm#10&
RewriteRule /modules/digest/u-cid_(.*)-(.*)\.htm$ /modules/digest/index.php?op=$1&category_id=$2
# http://gi.2288.org:88/modules/digest/index.php?op=update&category_id=4
# http://gi.2288.org:88/modules/digest/u-cid_update-4.htm
# --------------------Wordbook
RewriteRule /modules/wordbook/index.htm$ /modules/wordbook/index.php
RewriteRule /modules/wordbook/letter.htm$ /modules/wordbook/letter.php
RewriteRule /modules/wordbook/category.htm$ /modules/wordbook/category.php
RewriteRule /modules/wordbook/category_(.*)\.htm$ /modules/wordbook/category.php?categoryID=$1
# http://gi.2288.org:88/modules/wordbook/category.php?categoryID=1
# http://gi.2288.org:88/modules/wordbook/category_1.htm
RewriteRule /modules/wordbook/letter_(.*)\.htm$ /modules/wordbook/letter.php?init=$1
# http://gi.2288.org:88/modules/wordbook/letter.php?init=B
# http://gi.2288.org:88/modules/wordbook/letter_B.htm
RewriteRule /modules/wordbook/entry_(.*)\.htm$ /modules/wordbook/entry.php?entryID=$1
# http://gi.2288.org:88/modules/wordbook/entry.php?entryID=111
# http://gi.2288.org:88/modules/wordbook/entry_111.htm
# --------------------Wordpress
RewriteRule /modules/wordpress/index.htm$ /modules/wordpress/index.php
RewriteRule /modules/wordpress/index_(.*)\.htm$ /modules/wordpress/index.php?p=$1
# http://gi.2288.org:88/modules/wordpress/index.php?p=9
# http://gi.2288.org:88/modules/wordpress/index_9.htm
RewriteRule /modules/wordpress/cat_(.*)\.htm$ /modules/wordpress/index.php?cat=$1
# http://gi.2288.org:88/modules/wordpress/index.php?cat=1
# http://gi.2288.org:88/modules/wordpress/cat_1.htm
RewriteRule /modules/wordpress/m_(.*)\.htm$ /modules/wordpress/index.php?m=$1
# http://gi.2288.org:88/modules/wordpress/index.php?m=200412
# http://gi.2288.org:88/modules/wordpress/m_200412.htm
RewriteRule /modules/wordpress/author_(.*)\.htm$ /modules/wordpress/index.php?author=$1
# http://gi.2288.org:88/modules/wordpress/index.php?author=1
# http://gi.2288.org:88/modules/wordpress/author_1.htm
# --------------------Flashgames
RewriteRule /modules/flashgames/index.htm$ /modules/flashgames/index.php
RewriteRule /modules/flashgames/highscores.htm$ /modules/flashgames/highscores.php
RewriteRule /modules/flashgames/hit_(.*)\.htm$ /modules/flashgames/topten.php?hit=$1
# http://gi.2288.org:88/modules/flashgames/topten.php?hit=1
# http://gi.2288.org:88/modules/flashgames/hit_1.htm
RewriteRule /modules/flashgames/rate_(.*)\.htm$ /modules/flashgames/topten.php?rate=$1
# http://gi.2288.org:88/modules/flashgames/topten.php?rate=1
# http://gi.2288.org:88/modules/flashgames/rate_1.htm
RewriteRule /modules/flashgames/cid_(.*)\.htm$ /modules/flashgames/viewcat.php?cid=$1
# http://gi.2288.org:88/modules/flashgames/viewcat.php?cid=5
# http://gi.2288.org:88/modules/flashgames/cid_5.htm
RewriteRule /modules/flashgames/lid_(.*)\.htm$ /modules/flashgames/game.php?lid=$1
# http://gi.2288.org:88/modules/flashgames/game.php?lid=15
# http://gi.2288.org:88/modules/flashgames/lid_15.htm
# --------------------Mylinks
RewriteRule /modules/mylinks/index.htm$ /modules/mylinks/index.php
RewriteRule /modules/mylinks/submit.htm$ /modules/mylinks/submit.php
RewriteRule /modules/mylinks/submit.htm$ /modules/mylinks/submit.php
RewriteRule /modules/mylinks/hit_(.*)\.htm$ /modules/mylinks/topten.php?hit=$1
# http://gi.2288.org:88/modules/mylinks/topten.php?hit=1
# http://gi.2288.org:88/modules/mylinks/hit_1.htm
RewriteRule /modules/mylinks/rate_(.*)\.htm$ /modules/mylinks/topten.php?rate=$1
# http://gi.2288.org:88/modules/mylinks/topten.php?rate=1
# http://gi.2288.org:88/modules/mylinks/rate_1.htm
RewriteRule /modules/mylinks/cid_(.*)\.htm$ /modules/mylinks/viewcat.php?cid=$1
# http://gi.2288.org:88/modules/mylinks/viewcat.php?cid=5
# http://gi.2288.org:88/modules/mylinks/cid_5.htm
RewriteRule /modules/mylinks/visit_(.*)-(.*)\.htm$ /modules/mylinks/visit.php?cid=$1&lid=$2
# http://gi.2288.org:88/modules/mylinks/visit.php?cid=21&lid=14
# http://gi.2288.org:88/modules/mylinks/visit_21-14.htm
# --------------------XMLine
RewriteRule /modules/xmline/index.htm$ /modules/xmline/index.php
RewriteRule /modules/xmline/cid_(.*)\.htm$ /modules/xmline/index.php?category_id=$1
# http://gi.2288.org:88/modules/xmline/index.php?category_id=2
# http://gi.2288.org:88/modules/xmline/cid_2.htm
RewriteRule /modules/xmline/o-item_(.*)\.htm$ /modules/xmline/item.php?digest_id=$1
# http://gi.2288.org:88/modules/xmline/item.php?digest_id=32
# http://gi.2288.org:88/modules/xmline/o-item_32.htm
RewriteRule /modules/xmline/d-(.*)-(.*)\.htm$ /modules/xmline/index.php?op=$1&digest_id=$2
# http://gi.2288.org:88/modules/xmline/index.php?op=update&digest_id=40
# http://gi.2288.org:88/modules/xmline/d-update-40.htm
RewriteRule /modules/xmline/c-cid_(.*)\.htm$ /modules/xmline/custom.php?category_id=$1
# http://gi.2288.org:88/modules/xmline/custom.php?category_id=7
# http://gi.2288.org:88/modules/xmline/c-cid_7.htm
RewriteRule /modules/xmline/u-ccid_(.*)\.htm$ /modules/xmline/index.php?digest_id=$1
# http://gi.2288.org:88/modules/xmline/index.php?digest_id=40#40&
# http://gi.2288.org:88/modules/xmline/u-ccid_40#40.htm
RewriteRule /modules/xmline/ua-cid_(.*)-(.*)\.htm$ /modules/xmline/index.php?op=$1&category_id=$2
# http://gi.2288.org:88/modules/xmline/ua-cid_update-4.htm
# --------------------lykos_syndication
RewriteRule /modules/lykos_syndication/index.htm$ /modules/lykos_syndication/index.php
# --------------------Liaise
RewriteRule /modules/liaise/index.htm$ /modules/liaise/index.php
# --------------------Other
</VirtualHost>
-------------------------------------------------------------------------------------------------------------------------------
6.我发现太费时间了,-_-___,所以你拷贝"长下划线内的内容到Apache里,然后自己琢磨吧.
完
by Emerald
绿色学院 - Green Institute
http://gi.2288.org:88
gi 于 2005-01-15 00:04:36
本文地址:http://com.8s8s.com/it/it30876.htm