【问题标题】:.htaccess redirect to map old site structure to new site structure.htaccess 重定向以将旧站点结构映射到新站点结构
【发布时间】:2015-06-14 04:16:22
【问题描述】:

我已经用新的 CMS 改造了我的网站。

旧网站结构: www.domain.com/arc/web/index.shtml www.domain.com/arc/web/category/page.shtml

新网站结构:
www.domain.com
www.domain.com/category/page

我需要将旧网站结构的网页映射到新网站结构:
www.domain.com/arc/web/index.shtml 到 www.domain.com
www.domain.com/arc/web/category/page.shtml 到 www.domain.com/category/page

我尝试了以下重定向但无法正常工作:

重定向 301 /arc/web/aboutwecaneip/ http://www.wecaneip.com/about-us/what-we-do
重定向 301 /arc/web/aboutwecaneip/GuidingPrinciples.shtml http://www.wecaneip.com/about-us/what-we-do

处理这个问题的最佳方法是什么?

提前感谢所有帮助和建议。

【问题讨论】:

    标签: apache .htaccess redirect


    【解决方案1】:

    这对 mod-rewrite 很有用。

    这是您想要放入 apache 配置的特定用例的配置:

    <IfModule mod_rewrite.c>
       RewriteEngine on
       RewriteRule ^/arc/web/index.shtml$ /index.html [L]
       RewriteRule ^/arc/web/(.*)/(.*).shtml$ /$1/$2 [L]
    </IfModule>
    

    【讨论】:

    • 谢谢斯科特,我会试一试的! :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-04
    • 2017-07-25
    • 1970-01-01
    • 2013-01-07
    • 1970-01-01
    • 2018-05-01
    相关资源
    最近更新 更多