【问题标题】:.htaccess URL rewrite after migrating from Wordpress to Expression Engine从 Wordpress 迁移到 Expression Engine 后重写 .htaccess URL
【发布时间】:2013-08-14 08:32:32
【问题描述】:

我正在帮助客户将他们的博客从单独的 Wordpress 安装转移到他们新(而且非常大!)网站的整体 Expression Engine 安装的一部分。

博客的旧网址结构是www.site.com/blog/yyyy/mm/foo-bar-title

新的 URL 结构将是 www.site.com/blog/article/foo-bar-title

.htaccess 文件目前还没有那么复杂,本质上是这样的:

<IfModule mod_rewrite.c>
RewriteEngine On

# Removes index.php from ExpressionEngine URLs
RewriteCond $1 !\.(gif|jpe?g|png|xml)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

尽我所能,我似乎找不到一种重写方法,可以用 301 重定向重写 URL,而不会导致无限循环。

到目前为止,我有RewriteRule ^(.*)\[0-9]+/[0-9]+/?$ /blog/article/ [R=301],但这会导致无限循环。我查看了其他问题和答案,但它们似乎都只处理 Wordpress(当您搜索 wordpress 时),尽管严格来说这根本不涉及 wordpress,而只是表达式引擎。

非常感谢所有帮助!

【问题讨论】:

标签: regex url-rewriting expressionengine


【解决方案1】:

您可能会发现在修改此功能时打开 Apache Server 的重写日志会很有帮助。

我认为您正在寻找这样的东西:

重写规则 ^index.php/blog/[0-9]+/[0-9]+/(.*)$ /blog/article/$1 [R=301]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-13
    • 2021-03-26
    • 1970-01-01
    • 1970-01-01
    • 2011-10-16
    • 2013-08-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多