开发者

using htaccess to set default folder instead of file?

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 visit开发者_如何转开发s 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.


Try this mod_rewrite rule:

RewriteEngine on
RewriteRule ^$ foo/bar [L]

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜