容器技术交流

 找回密码
 立即注册
查看: 5774|回复: 15

FAMP下支持不支持仿静态?

[复制链接]
发表于 2008-12-23 20:37:55 | 显示全部楼层 |阅读模式
FAMP下支持不支持仿静态?

不知道有没有添加mod_rewrite模块?

如何设置DZ7.0仿静态?

下面是代码,添加了不行哦。


RewriteEngine on
# 修改以下语句中的 /bbs 为你的论坛目录地址,如果程序放在根目录中,请将 /bbs 修改为 /
Rewrite /
RewriteRule ^archiver/((fid|tid)-[\w\-]+\.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



我的在根目录下。。还是不行。
发表于 2008-12-23 20:42:47 | 显示全部楼层
支持
DZ的官方文档中有详细说明
有两种方法:
一是在网站的根目录下建一个“.htaccess”(注意前面的点)文件
二是在apache的虚拟主机配置文件中加入以上代码,即
<VirtualHost *:80>
Rewrite /
RewriteRule ^archiver/((fid|tid)-[\w\-]+\.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

    DocumentRoot /home/wwwroot/zijidelu.com
    Serveralias zijidelu.com
</VirtualHost>
发表于 2008-12-23 20:43:10 | 显示全部楼层
记得重启apache:
/apache-restart
 楼主| 发表于 2008-12-23 20:54:50 | 显示全部楼层

<VirtualHost *:80>
Rewrite /
RewriteRule ^archiver/((fid|tid)-[\w\-]+\.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

    DocumentRoot /home/wwwroot/zijidelu.com
    Serveralias zijidelu.com
</VirtualHost>


这段是在

  1. httpd.conf

复制代码


还是在
  1. httpd-vhosts.conf
复制代码
 楼主| 发表于 2008-12-23 20:58:00 | 显示全部楼层

  1. <VirtualHost *:80>
  2. Rewrite /
  3. RewriteRule ^archiver/((fid|tid)-[\w\-]+\.html)$ archiver/index.php?$1
  4. RewriteRule ^forum-([0-9]+)-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2
  5. RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ viewthread.php?tid=$1&extr
  6. a=page\%3D$3&page=$2
  7. RewriteRule ^space-(username|uid)-(.+)\.html$ space.php?$1=$2
  8. RewriteRule ^tag-(.+)\.html$ tag.php?name=$1

  9. DocumentRoot /home/ftp/xared
  10. Serveralias www.xared.cn
  11. </VirtualHost>
  12. httpd-vhosts.conf: 76 lines, 2532 characters.
  13. web# /apache-restart
  14. Syntax error on line 67 of /usr/local/apache/conf/extra/httpd-vhosts.conf:
  15. Invalid command 'Rewrite', perhaps misspelled or defined by a module not included in the server configuration
  16. httpd not running, trying to start
复制代码


出错了。大哥。
发表于 2008-12-23 21:00:09 | 显示全部楼层
你去分段干嘛?本来是一行的
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ viewthread.php?tid=$1&extr
a=page\%3D$3&page=$2
 楼主| 发表于 2008-12-23 21:00:38 | 显示全部楼层
第一种我从官方下了很多版本的。

就是.htaccess文件。

第二种 我加了。 httpd-vhosts.conf 中。

出错了。
 楼主| 发表于 2008-12-23 21:01:36 | 显示全部楼层
原帖由 爱洞特漏 于 2008-12-23 21:00 发表
你去分段干嘛?本来是一行的
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ viewthread.php?tid=$1&extr
a=page\%3D$3&page=$2


没有分段。。是一行。
 楼主| 发表于 2008-12-23 21:04:31 | 显示全部楼层
  1. <VirtualHost *:80>
  2. Rewrite /
  3. RewriteRule ^archiver/((fid|tid)-[\w\-]+\.html)$ archiver/index.php?$1
  4. RewriteRule ^forum-([0-9]+)-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2
  5. RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ viewthread.php?tid=$1&extra=page\%3D$3&page=$2
  6. RewriteRule ^space-(username|uid)-(.+)\.html$ space.php?$1=$2
  7. RewriteRule ^tag-(.+)\.html$ tag.php?name=$1

  8. DocumentRoot /home/wwwroot/zijidelu.com       这个是网站的根目录
  9. Serveralias zijidelu.com                        这个应该是文件夹吧
  10. </VirtualHost>
复制代码


真不知道是哪的问题。两种办法都试了。
 楼主| 发表于 2008-12-23 21:11:22 | 显示全部楼层
一重起就提示 67行有错误。  看了下。67行是


  1. RewriteRule ^archiver/((fid|tid)-[\w\-]+\.html)$ archiver/index.php?$1

复制代码
发表于 2008-12-23 21:20:39 | 显示全部楼层
不好意思,应该是这样的

<VirtualHost *:80>
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.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
</IfModule>
DocumentRoot /home/wwwroot/zijidelu.com       网站根目录
Serveralias zijidelu.com                       域名
</VirtualHost>
发表于 2008-12-23 21:21:42 | 显示全部楼层
.htaccess
中的内容才是那个,直接加在httpd-vhost.conf中的内容上楼上的这种
 楼主| 发表于 2008-12-23 21:27:38 | 显示全部楼层
<VirtualHost *:80>
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.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
</IfModule>
DocumentRoot /home/ftp/xared
Serveralias www.xared.cn
</VirtualHost>

这样的。。
 楼主| 发表于 2008-12-23 21:29:33 | 显示全部楼层
我明白你说的意思了。
 楼主| 发表于 2008-12-23 21:30:51 | 显示全部楼层
  1. <VirtualHost *:80>
  2. <IfModule mod_rewrite.c>
  3. RewriteEngine On
  4. RewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2
  5. RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3
  6. RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3
  7. RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3
  8. RewriteRule ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2
  9. </IfModule>
  10. DocumentRoot /home/ftp/xared
  11. Serveralias www.xared.cn
  12. </VirtualHost>
复制代码


这段插在
  1. httpd-vhosts.conf
复制代码


就可以了。

如果用这个方法那么根目录下就不用上传
  1. .htaccess
复制代码
这个了。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Archiver|URLOS ( 粤ICP备18087780号 )

GMT+8, 2024-5-9 02:43 , Processed in 0.030640 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表