我只是想知道如何从根Apache的执行重定向。
我要检查,如果有人去根URL(如: example.com
),并将其重定向到 example.com/h
自动。
我能做到这一点的Apache的配置,或者在的.htaccess
文件?
了NameVirtualHost *:80
<虚拟主机*:80>
服务器名example.com
RedirectMatch 301 ^ / $ /小时
< /虚拟主机>
这将帮助您重定向从 example.com
您所有的要求 example.com/h
I was just wondering how to perform a redirect from root in Apache.
I want to check if someone goes to the root url (eg. example.com
) and redirect them to example.com/h
automatically.
Can I do this in apache config, or in a .htaccess
file?
NameVirtualHost *:80
<VirtualHost *:80>
ServerName example.com
RedirectMatch 301 ^/$ /h
</VirtualHost>
This will help you to redirect all your request from example.com
to example.com/h