htaccess 重写除索引和根之外的所有内容
我正在尝试建立一个站点,将除根目录和索引之外的所有内容转发到变量中。我现在已经像这样设置了 htaccess 文件:
Options +FollowSymlinks
RewriteEngine on
RewriteRule -(.*)$ http://blah.com/blah.php?name=$1 [R,NC]
这样索引就可以工作,并且以连字符(-)开头的任何内容都会被重写
我希望能够重写索引文件之外的任何内容,并且仍然允许通过 blah.com 和 blah.com/ 访问索引文件
有什么想法吗?
I'm trying to set up a site that forwards everything but the root directory and index into a variable. I have the htaccess file set up like this right now:
Options +FollowSymlinks
RewriteEngine on
RewriteRule -(.*)$ http://blah.com/blah.php?name=$1 [R,NC]
just so that the index works and anything that starts with a hyphen(-) is rewritten
I would like to be able to have anything that isn't the index file rewritten, and still allow the index file be accessed via blah.com and blah.com/
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
Try this :
如果你仍然没有弄清楚这一点,这应该可行:
If by any chance you still haven't figured this out, this should work: