【问题标题】:Apache URL point to rootApache URL 指向根目录
【发布时间】:2012-05-27 20:25:45
【问题描述】:

是否可以在 apache 中路由任何 URL 以始终指向我的 VirtualHost 中的 DocumentRoot?

这样 f.ex: /foo/bar/ 将始终请求 /

我在想类似的东西(请原谅我的新手伪代码):

AliasMatch ^/.* DocumentRoot

【问题讨论】:

标签: apache url routing virtualhost


【解决方案1】:

以下内容似乎是大多数 CMS 使用的模式。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-03
    • 2015-10-21
    • 1970-01-01
    • 2015-09-02
    • 1970-01-01
    • 2015-04-23
    • 2021-11-26
    • 2015-12-14
    相关资源
    最近更新 更多