ray1980
ray1980
4194 10 0

修改贴子链接后发表评论出现404 Not Found

原先的
t-1改为了topic/1
n-1改为了node/1
发贴正常,
发表评论后,会跳到 xxx.com/topic/1/1#new-comment
然后网页404 Not Found

请问下这个要如何改啊?

0

See Also

Nearby


Discussion (10)

ego008
ego008 2013-04-21 13:12

用哪个版本?
若方便发个网址看看

0
ray1980
ray1980 2013-04-21 13:17

@ego008 http://www.wpcnz.com 用的独立VPS不带缓存版

0
ego008
ego008 2013-04-21 13:32

修改.htaccess 增加对格式 /topic/1/1 解析

把评论页数修改为 /topic/1-1 格式

0
ray1980
ray1980 2013-04-21 13:45

@ego008 用的是nginx,不知道/topic/1/1,对应的是哪个地址

0
ego008
ego008 2013-04-21 13:48

@ray1980 这里有一个 https://www.youbbs.org/t/201
我照葫芦画瓢,不知行不行
rewrite ^/topic/([0-9]+)(/([0-9]*))?$ /topicpage.php?tid=$1&page=$3 last;

0
ray1980
ray1980 2013-04-21 13:50

这是我的配置文件,里面有这一条
location /
{
rewrite ^/node/([0-9]+)(/([0-9]))?$ /nodepage.php?cid=$1&page=$3 last;
rewrite ^/topic/([0-9]+)(/([0-9]
))?$ /topicpage.php?tid=$1&page=$3 last;
rewrite ^/page/([0-9]+)$ /indexpage.php?page=$1 last;
rewrite ^/notifications$ /notifications.php last;
rewrite ^/favorites$ /favorites.php last;
rewrite ^/qqlogin$ /qqlogin.php last;
rewrite ^/qqcallback$ /qqcallback.php last;
rewrite ^/qqsetname$ /qqsetname.php last;
rewrite ^/wblogin$ /wblogin.php last;
rewrite ^/wbcallback$ /wbcallback.php last;
rewrite ^/wbsetname$ /wbsetname.php last;
rewrite ^/feed$ /feed.php last;
rewrite ^/robots.txt$ /robots.php last;
rewrite ^/sitemap-([0-9]+)$ /sitemap.php?id=$1 last;
rewrite ^/forgot$ /forgot.php last;
rewrite ^/upload-(650|590)$ /upload.php?mw=$1 last;
rewrite ^/viewat-(desktop|mobile)$ /viewat.php?via=$1 last;
rewrite ^/goto-t-([0-9]+)$ /gototopic.php?tid=$1 last;
rewrite ^/member/(.+)$ /member.php?mid=$1 last;
rewrite ^/newpost/([0-9]+)$ /newpost.php?cid=$1 last;

0
ego008
ego008 2013-04-21 13:55

修改试一下
rewrite ^/topic/([0-9]+)(/([0-9]))?$ /topicpage.php?tid=$1&page=$3 last;
rewrite ^/topic/([0-9]+)/?([0-9]
)$ /topicpage.php?tid=$1&page=$2 last;

0
ray1980
ray1980 2013-04-21 13:57

@ego008 两条?用哪一条?

0
ego008
ego008 2013-04-21 14:00

@ray1980 我没环境测试,看哪个行,不行再微调。
目前
rewrite ^/topic/([0-9]+)(/([0-9]*))?$ /topicpage.php?tid=$1&page=$3 last;
能打开 /topic/1-1 的格式

0
ray1980
ray1980 2013-04-21 14:05

@ego008 谢谢大神 用了这条就解决了
rewrite ^/topic/([0-9]+)(/([0-9]*))?$ /topicpage.php?tid=$1&page=$3 last;

能跳转到 topic/77#new-comment

谢谢!

0
Login Topics