【发布时间】:2012-02-11 17:41:55
【问题描述】:
我有这样的 URL 结构
http://domain.com/page/thing1
http://domain.com/page/thing2
http://domain.com/page/thing3
我想:
- 从 URL 中删除 /page/
- 提供来自 /page/thing1 的内容
我正在使用 ExpressionEngine,所以这是我从 URL 中删除 index.php 的方法
<IfModule mod_rewrite.c>
RewriteEngine On
# Removes index.php
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
【问题讨论】:
-
您不一定必须通过 ModRewrite 执行此操作,具体取决于您在 EE 中访问此数据的方式。这些 URL 是通过 Pages 模块创建的吗?还是
page是模板组而thing1是模板?或者是thing1、thing2等,所有条目的 URL 标题? -
@DerekHogue 现在我已经设置好了,其中 page 是一个模板组,thing1 和 thing 2 是条目。
-
在这种情况下,see rjb's answer - Pages 模块是这里的方法。通过第一段通过 URL 标题访问单个条目不是一个好方法。
标签: apache .htaccess mod-rewrite redirect expressionengine