您好,欢迎访问一九零五行业门户网

记录一下刚用mod_rewrite做的分域名以及静态化链接 codeigniter_PHP教程

记录一下刚用mod_rewrite做的分域名以及静态化链接 codeigniter
解决方法
1.看看你的apache2/bin/httpd l
里面有没有 mod_rewrite.so
没有的话请重编译 withrewrite
2.httpd.conf增加 load module(语法自己查)
重启apache的时候如果出现什么 in build的时候,表示已经把该模块编译到apache了,不需要加载了,去掉刚才那行 httpd.conf
3.打开你的conf/extra/httpdvhosts.conf
找到你的虚拟主机,这是我的配置文件
我需要把7个频道分出来,注意,主机头正则不能.+?匹配,这样会干掉你的img.domain.com,所以谨慎点好
serveradmin [url=http://www.phpchina.com/bbs/mailto:www@domain.com]链接标记www@domain.com[/url]
documentroot /data0/wwwroot/www2.domain.com/
servername [url=http://www.domian.com/]链接标记www.domian.com[/url]
serveralias game.domain.com soft.domain.com video.domain.com theme.domain.com ebook.domain.com pic.domain.com audio.domain
i.com domain.com
errorlog |/usr/local/sbin/cronolog /data1/logs/httpd/www2/error_log.%y%m%d
customlog |/usr/local/sbin/cronolog /data1/logs/httpd/www2/access_log.%y%m%d combined
rewriteengine on
rewritecond %{http_host} ^(game|soft|video|theme|pic|audio|ebook).domain.com$
rewriterule ^(.+) %{http_host}$1 [c]
rewriterule ^(game|soft|video|theme|pic|audio|ebook).domain.com(/*)$ /index.php/$1
rewriterule ^(game|soft|video|theme|pic|audio|ebook).domain.com/(lists|detail)/(.*?).html$ /index.php/$1/$2/$3
以上配置,能帮我把 [url=http://www.domain.com/index.php/game]链接标记http://www.domain.com/index.php/game[/url] 伪装为 [url=http://game.domain.com/]链接标记http://game.domain.com[/url]
[url=http://game.domain.com/lists/2/40.html]链接标记http://game.domain.com/lists/2/40.html[/url] => [url=http://www.domain.com/index.php/game/lists/2/40]链接标记http://www.domain.com/index.php/game/lists/2/40[/url]
注意apache2/bin/apachectl restart
[ ]
d8888d回贴内容
关键是url 正则匹配。[img]http://www.phpchina.com/bbs/images/smilies/default/biggrin.gif[/img]
d8888d回贴内容
我觉得那个你不如建个二级域名指向了。
如果要是应用到会员每人一个链接上,这样实验还算可以理解。我觉得这样apache的增加不少负载吧
http://www.bkjia.com/phpjc/632531.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/632531.htmltecharticle记录一下刚用mod_rewrite做的分域名以及静态化链接 codeigniter 解决方法 1.看看你的apache2/bin/httpd l 里面有没有 mod_rewrite.so 没有的话请重编译...
其它类似信息

推荐信息