Php .htaccess是否不重定向?
我有以下.htaccess文件:Php .htaccess是否不重定向?,php,mysql,html,apache,Php,Mysql,Html,Apache,我有以下.htaccess文件: RewriteRule ^s/([a-zA-Z]+) /servers/page.php?name=$1 RewriteRule ^s/([a-zA-Z]+)/new-thread /servers/new-thread.php?name=$1 从第一行可以看出,这是: mydomain.com/s/hello实际上显示了页面的内容mydomain.com/servers/page.php?name=hello 第二行: mydomain.com/s/hel
RewriteRule ^s/([a-zA-Z]+) /servers/page.php?name=$1
RewriteRule ^s/([a-zA-Z]+)/new-thread /servers/new-thread.php?name=$1
从第一行可以看出,这是:
mydomain.com/s/hello
实际上显示了页面的内容mydomain.com/servers/page.php?name=hello
第二行:
mydomain.com/s/hello/new-thread
应该向我显示页面内容:mydomain.com/servers/new-thread.php?name=hello
但当我输入后一个URL时,我会得到前一个页面的内容
这意味着,如果我键入mydomain.com/s/hello/new-thread
,就会显示内容,就像键入mydomain.com/s/hello
一样。有人能告诉我这是为什么吗?提前谢谢你 试试这个:
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]
试试这个:
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]
[L]是什么意思,它有什么作用?@Ken:意思是在这一行之后不要再处理任何规则。如果没有它,下一行只处理前一行的输出。如果你不想让事情区分大小写,你可以使用
[NC,L]
。[L]是什么意思,它有什么作用?@Ken:means在这一行之后不要再处理任何规则。如果没有它,下一行只处理前一行的输出。如果不想区分大小写,可以使用[NC,L]
。