简体   繁体   English

.htaccess无法重定向?

[英].htaccess not redirecting?

I have the following .htaccess file: 我有以下.htaccess文件:

RewriteRule ^s/([a-zA-Z]+) /servers/page.php?name=$1

RewriteRule ^s/([a-zA-Z]+)/new-thread /servers/new-thread.php?name=$1

As you can see by the first line, this: 如第一行所示,这是:

mydomain.com/s/hello actually shows me the content of the page mydomain.com/servers/page.php?name=hello mydomain.com/s/hello实际上向我显示了页面的内容mydomain.com/servers/page.php?name=hello

and the second line: 第二行:

mydomain.com/s/hello/new-thread SHOULD show me the contents of the page: mydomain.com/servers/new-thread.php?name=hello , mydomain.com/s/hello/new-thread 应该向我显示页面内容: mydomain.com/servers/new-thread.php?name=hello

but when I type the latter URL, I get the contents of the former page. 但是当我输入后一个URL时,我得到了前一页的内容。

This means if I type mydomain.com/s/hello/new-thread , I get shown the contents as if I typed mydomain.com/s/hello . 这意味着,如果我键入mydomain.com/s/hello/new-thread ,则会显示内容,就像我键入mydomain.com/s/hello Can someone point out to me why that is? 有人可以指出为什么吗? Thank you in advance! 先感谢您!

Try this: 尝试这个:

RewriteRule ^s/([a-zA-Z]+)/new-thread /servers/new-thread.php?name=$1 [L]
RewriteRule ^s/([a-zA-Z]+) /servers/page.php?name=$1 [L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM