Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

[已答复] ss下怎么设置子文件夹的.htaccess重写?(老问题新内容)

[复制链接]
zhuisu 发表于 2009-10-18 23:55:37 | 显示全部楼层 |阅读模式
本帖最后由 zhuisu 于 2009-10-18 23:57 编辑

大家好,.htaccess虽然是个老问题了,但是我的这个情况好像还没有发现解决方案,问题如下:
我把ss设置主站信息,但为了方便跟目录下清晰管理,所以把ss安装在了根目录的info文件夹下
就是为了实现下面的效果:

原url:
资讯首页 http://www.bianjichuban.com/info/
内容信息 http://www.bianjichuban.com/info/?action-viewnews-itemid-1 等等是
为了http://www.bianjichuban.com/也可以作为首页,等同于http://www.bianjichuban.com/info/ 的内容,所以做了.htaccess如下(可以正常使用):
# Use PHP5 as default
AddHandler application/x-httpd-php5 .php

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www.)?bianjichuban.com$
RewriteCond %{REQUEST_URI} !^/info/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /info/$1
RewriteCond %{HTTP_HOST} ^(www.)?bianjichuban.com$
RewriteRule ^(/)?$ info/index.php [L]


这个时候,我为了把:
内容信息 http://www.bianjichuban.com/info/?action-viewnews-itemid-1
显示为   http://www.bianjichuban.com/info/viewnews-1.html
需要一个新的.htaccess,可是我写了几次都要么1 http://www.bianjichuban.com无法访问,要么2 http://www.bianjichuban.com/info/viewnews-1.html不对
如1错误的:
  1. # Use PHP5 as default
  2. AddHandler application/x-httpd-php5 .php
  3. RewriteEngine on
  4. RewriteCond %{HTTP_HOST} ^(www.)?bianjichuban.com$
  5. RewriteCond %{REQUEST_URI} !^/info/
  6. RewriteCond %{REQUEST_FILENAME} !-f
  7. RewriteCond %{REQUEST_FILENAME} !-d
  8. RewriteRule ^(.*)$ /info/$1
  9. RewriteCond %{HTTP_HOST} ^(www.)?bianjichuban.com$
  10. RewriteRule ^(/)?$ info/index.php [L]

  11. RewriteBase /info
  12. # SupeSite Rewrite
  13. RewriteRule ^([0-9]+)/spacelist(.+)$ index.php?uid/$1/action-spacelist-type$2 [L]
  14. RewriteRule ^([0-9]+)/viewspace(.+)$ index.php?uid/$1/action-viewspace-itemid$2 [L]
  15. RewriteRule ^([0-9]+)/viewbbs(.+)$ index.php?uid/$1/action-viewbbs-tid$2 [L]
  16. #RewriteRule ^([0-9]+)/(.*)$ index.php?uid/$1/$2 [L]
  17. #RewriteRule ^([0-9]+)$ index.php?uid/$1 [L]
  18. RewriteRule ^action(.+)$ index.php?action$1 [L]
  19. RewriteRule ^category(.+)$ index.php?action-category-catid$1 [L]
  20. RewriteRule ^viewnews(.+)$ index.php?action-viewnews-itemid$1 [L]
  21. RewriteRule ^viewthread(.+)$ index.php?action-viewthread-tid$1 [L]
  22. RewriteRule ^mygroup(.+)$ index.php?action-mygroup-gid$1 [L]
复制代码
把RewriteBase /info去除,则2无法访问
请教,如何写才对啊,另外
还有/uc/是另外的系统,也需要规则
我不会正则,谢谢大家好心人
回复

使用道具 举报

 楼主| zhuisu 发表于 2009-10-19 00:18:36 | 显示全部楼层
似乎找到一个解决方案,那就是在info文件夹下新建立一个.htaccess
不知道怎么设置,让info/的都自动指向到/根目录
回复

使用道具 举报

lidq.jingwu 发表于 2009-10-19 09:16:35 | 显示全部楼层
本帖最后由 lidq.jingwu 于 2009-10-19 09:18 编辑

分两部分来写吧,将域名的跳转放到服务器根目录下面,将supesite的伪静态规则放到info文件夹下面,然后用下面的规则试一下(info文件夹中的规则):
  1. ###        将 RewriteEngine 模式打开
  2. RewriteEngine On

  3. ###        修改以下语句中的 /supesite 修改为你的SupeSite目录地址,如果程序放在根目录中,请将 /supesite 修改为 /
  4. RewriteBase /info

  5. ###        Rewrite 系统规则请勿修改
  6. RewriteRule ^([0-9]+)/spacelist(.+)$ index.php?uid/$1/action/spacelist/type$2 [L]
  7. RewriteRule ^([0-9]+)/viewspace(.+)$ index.php?uid/$1/action/viewspace/itemid$2 [L]
  8. RewriteRule ^([0-9]+)/viewbbs(.+)$ index.php?uid/$1/action/viewbbs/tid$2 [L]
  9. RewriteRule ^([0-9]+)/(.*)$ index.php?uid/$1/$2 [L]
  10. RewriteRule ^([0-9]+)$ index.php?uid/$1 [L]

  11. RewriteRule ^action(.+)$ index.php?action$1 [L]
  12. RewriteRule ^category(.+)$ index.php?action/category/catid$1 [L]
  13. RewriteRule ^viewnews(.+)$ index.php?action/viewnews/itemid$1 [L]
  14. RewriteRule ^viewthread(.+)$ index.php?action/viewthread/tid$1 [L]
  15. RewriteRule ^mygroup(.+)$ index.php?action/mygroup/gid$1 [L]
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-11-23 16:06 , Processed in 0.110816 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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