【发布时间】:2011-08-13 21:29:29
【问题描述】:
我浏览了其他主题,包括这个:Mod_rewrite invisibly: works when target is a file, not when it's a directory,但我找不到解决问题的方法。
我有以下重写规则:
RewriteRule ^([a-zA-Z0-9_-]+)$ ./index.php?s=$1 [L,NC]
RewriteRule ^([a-zA-Z0-9_-]+)/$ ./index.php?s=$1 [L,NC]
它的作用是将http://myaddress/parameter 到http://myaddress/index.php?s=parameter 之类的任何内容写入并在浏览器的地址栏中显示这个新的重写地址。
如何在地址栏不显示重写后的 URL 的情况下进行重写?
编辑
这是我的 .htaccess 文件的内容:
DirectoryIndex index.php
RewriteEngine On
RewriteRule ^([a-z0-9_\-]+)/?$ index.php?s=$1 [L,NC,QSA]
RewriteRule ^([a-zA-Z0-9_-]+)\/?([a-zA-Z0-9_-]+)\/?$ index.php?u=$1&s=$2 [L,NC]
RewriteRule ^([a-zA-Z0-9_-]+)\/?([a-zA-Z0-9_-]+)\/?([a-zA-Z0-9_-]+)\/?$ index.php?u1=$1&u2=$2&s=$3 [L,NC]
【问题讨论】: