Mod rewrite mod_重写理解子目录,同时传递$_获取值服务器问题?
这很可能是服务器配置问题;或者只是一个我不知道的显而易见的原因 修改前重写URL:Mod rewrite mod_重写理解子目录,同时传递$_获取值服务器问题?,mod-rewrite,url-rewriting,apache2,Mod Rewrite,Url Rewriting,Apache2,这很可能是服务器配置问题;或者只是一个我不知道的显而易见的原因 修改前重写URL: www.example.com/subfolder/index.php?userName=x 设计的mod_重写: RewriteEngine on RewriteRule ^subfolder/[^/]([\w]*)$ /subfolder/index.php?userName=$1 [L] 我的理解是,上面应该允许导航到:www.example.com/subfolder/x。但是,这会导致404错误 重
www.example.com/subfolder/index.php?userName=x
设计的mod_重写:
RewriteEngine on
RewriteRule ^subfolder/[^/]([\w]*)$ /subfolder/index.php?userName=$1 [L]
我的理解是,上面应该允许导航到:www.example.com/subfolder/x
。但是,这会导致404错误
重写无子文件夹工作精细;只有在将子文件夹添加到要放置的混合对象时,才会出现这种情况
非常感谢你的建议 试试这个(对我来说没问题):
注意:
此规则将放置在.htaccess中。如果放置在服务器配置/虚拟主机上下文中,则需要进行一些小的调整 嗨@LazyOne工作得很好-非常感谢你;你的努力很难反映你的用户名。再次感谢
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/subfolder/index\.php$
RewriteRule ^subfolder/([^/]+)$ /subfolder/index.php?userName=$1 [L]