使用 htaccess 设置默认文件夹而不是文件?
是否可以设置一个默认文件夹来访问而不是像“index.html”这样的文件。
我想要做的是,当人们访问我的网站时,他们会被重定向到域根目录中的文件夹。我正在使用博客引擎,我需要它显示为主页,但我不想将其安装在根目录中,因为我还有其他文件夹和文件需要位于根目录中。我不想把它们放在博客软件的文件夹中。我也不想使用 301 或 3XX 重定向来实现 SEO 目的。
如果有办法做到我所要求的,请告诉我。如果没有,请让我知道最好的选择。
Is it possible to set a default folder to access instead of a file like "index.html".
What I'd like to to is make it so that when a person visits my site they get redirected to a folder within the root of the domain. I am using a blogging engine and I need it to show up as the homepage but I don't want to install it in the root because I have other folders and files that need to be in the root directory. And I don't want to put them inside the blogging software's folder. I also don't want to use a 301 or 3XX redirect for SEO purposes.
If there's a way to do what I'm asking let me know. If not, let me know the best option otherwise.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试这个 mod_rewrite 规则:
这将重写请求到该目录规则应用于 foo/bar。因此,如果您将此规则放入文档根目录中的 .htaccess 文件中并请求 http://example.com/< /a>,它将被重写为 http://example.com/foo/酒吧。
Try this mod_rewrite rule:
This will rewrite requests to the directory where this rule is applied to to foo/bar. So if you put this rule in the .htaccess file in your document root and request http://example.com/, it will get rewritten to http://example.com/foo/bar.