Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of module_invoke_all(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in /home/.megatoes/geniusy/geniusy/drupal/modules/fuzzysearch/fuzzysearch.module on line 324
Apache虚拟主机静态化规则改独立主机rewrite规则 | Geniusy's Blog

Apache虚拟主机静态化规则改独立主机rewrite规则

 in LAMPP

如果开启.htaccess查找功能会影响系统速度,所以自从搭建服务器后都没有打开这个功能。加上discuz和phpwind都是推荐直接在httpd.conf中加的,所以一直都没去动过这个。 但前几天装phpbb的那个url优化mod,竟然没提供独立主机的规则,之后装Sablog-X也没有提供。呵呵,就想到自己改了,其实discuz提供了很好的教程,自己把两种规则一对照,规律一下子就出来了,下面简单来说说吧,先把discuz 6.0的两种规则列出来: Apache虚拟主机rewrite规则: # 将 RewriteEngine 模式打开 RewriteEngine On # 修改以下语句中的 /discuz 为你的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 / RewriteBase /discuz # Rewrite 系统规则请勿修改 RewriteRule ^archiver/((fid|tid)-[0-9]+\.html)$ archiver/index.php?$1 RewriteRule ^forum-([0-9]+)-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2 RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ viewthread.php?tid=$1&extra=page\%3D$3&page=$2 RewriteRule ^space-(username|uid)-(.+)\.html$ space.php?$1=$2 RewriteRule ^tag-(.+)\.html$ tag.php?name=$1 Apache独立主机rewrite规则:

RewriteEngine On RewriteRule ^(.*)/archiver/((fid|tid)-[0-9]+\.html)$ $1/archiver/index.php?$2 RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3 RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3 RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3 RewriteRule ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2 两者对比,不难发现,之间有三处区别: 1、独立主机每条规则以^(.*)开头,而虚拟主机就是^,所以加入(.*)就行了; 2、独立主机规则的后半段以$1/开头,虚拟主机没有,也是加上就行了; 3、独立主机因为前面已经有了$1,所以后面就应该依次是$2,$3,改一下数字就行了。 今后大家再遇到这种情况就可以自己改了,呵呵。国外的cms一般都比较小家子气,首先界面和定位是博客,它以为它的用户也都全是只能买虚拟主机的,所以一般都不提供独立主机Rewrite规则。 呵呵,Sablog本来就是一个博客,所以不提供也正常啦,我还是把改好的规则拿出来和大家分享吧。 RewriteEngine On RewriteRule ^(.*)/show-([0-9]+)-([0-9]+)\.html$ $1/index.php?action=show&id=$2&page=$3 RewriteRule ^(.*)/category-([0-9]+)-([0-9]+)\.html$ $1/index.php?action=index&cid=$2&page=$3 RewriteRule ^(.*)/archives-([0-9]+)-([0-9]+)\.html$ $1/index.php?action=index&setdate=$2&page=$3 RewriteRule ^(.*)/(archives|search|reg|login|index|links)\.html$ $1/index.php?action=$2 RewriteRule ^(.*)/(comments|tagslist|trackbacks|index)-([0-9]+)\.html$ $1/index.php?action=$2&page=$3 大家把这段加入和之间就行了。 下面是改好的PHPBB 3.0 beta7 的独立主机规则,不分享浪费啊,呵呵。 RewriteEngine On Rewriterule ^(.*)/(.+)-f([0-9]*).html-(.+)$ $1/viewforum.php?f=$3&$4 Rewriterule ^(.*)/(.+)-(t|p)([0-9]*).html-(.+)$ $1/viewtopic.php?$3=$4&$5 Rewriterule ^(.*)/(.+)-f([0-9]*)s([0-9]*).html-(.+)$ $1/viewforum.php?f=$3&start=$4&$5 Rewriterule ^(.*)/(.+)-(t|p)([0-9]*)s([0-9]*).html-(.+)$ $1/viewtopic.php?$3=$4&start=$5&$6 Rewriterule ^(.*)/(.+)-f([0-9]*).html$ $1/viewforum.php?f=$3&$4 Rewriterule ^(.*)/(.+)-(t|p)([0-9]*).html$ $1/viewtopic.php?$3=$4&$5 Rewriterule ^(.*)/(.+)-f([0-9]*)s([0-9]*).html$ $1/viewforum.php?f=$3&start=$4&$5 Rewriterule ^(.*)/(.+)-(t|p)([0-9]*)s([0-9]*).html$ $1/viewtopic.php?$3=$4&start=$5&$6

Tags: apache, phpbb, rewrite, sablog, 独立主机

发表新评论

此内容将保密,不会被其他人看见。
  • You can use BBCode tags in the text, URLs will automatically be converted to links.
  • You can use coolfilter tags in the text, to include code and media
  • Image links from G2 are formatted for use with Lightbox.V2
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ol> <dl> <dt> <dd> <img> <inline> <center> <p> <object> <br> <th> <tr> <td> <embed>
  • 网页地址和电子邮件地址将会被自动转换为链接。

更多格式化选项信息

Similar

Similar