【发布时间】:2012-12-14 16:24:23
【问题描述】:
我正在寻找一个.htaccess 文件,它可以让任何请求传递到其原始目标但重定向到特定文件夹(在这种情况下为启动屏幕),但没有指定目标。我不太熟悉.htaccess,希望能得到一些帮助。
示例:我正在请求http://www.domain.com/folder/file.php,它应该可以通过。但是如果我请求http://www.domain.com/,它应该重定向到http://www.domain.com/splash/。
到目前为止,我的内容正确重定向到 /splash/,但将 一切 重定向到 /splash/。
<IfModule mod_rewrite.c>
RewriteEngine On
# If the requested URI is empty...
RewriteCond %{REQUEST_URI} !^$
# ...then redirect to the "splash" folder
RewriteRule .* splash [L]
# Otherwise rewrite the base
RewriteBase /
# If the request is not a folder or a file, redirects to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
谢谢!
编辑:重要的一点是将http://www.domain.com/ 重定向到http://www.domain.com/splash/,但允许直接访问http://www.domain.com/index.php。
【问题讨论】:
标签: .htaccess