最好的办法,为的.htaccess临时重定向(302)与异常

编程入门 行业动态 更新时间:2024-10-25 06:24:20
本文介绍了最好的办法,为的.htaccess临时重定向(302)与异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

首先,我知道有上的.htaccess设置相当多的职位,但我看不到一个一致的答案,所以我不知道什么是最好的办法。所以请裸陪我,如果我重复的东西从其他地方。

First, I realise there are quite a few posts on .htaccess settings but I can't see a consistent answer so I'm wondering what is the best approach. So please bare with me if I'm repeating something from elsewhere.

我在执行更新到网站,所以我想创建一个302临时重定向,除了一个特定页面的所有网页。

易腐press对的,我现在使用的选项1的话题两篇文章:

perishablepress has two articles on the topic for which I am currently using option 1:

  • 的perishable$p$pss/temporary-site-redirect-for-visitors-during-site-updates/
  • HTTP://perishable$p$pss / htaccess的重定向的维修页网站更新/
  • perishablepress/temporary-site-redirect-for-visitors-during-site-updates/
  • perishablepress/htaccess-redirect-maintenance-page-site-updates/
  • 这些物品是指修改的所有页面,在这里我有一个网页我想保持住。 (因为它的推移,我努力让选项2,在所有的工作)。谁能告诉我什么是实现这一目标的最佳途径?

    These article refer to amending all pages, where as I have one page I want to keep live. (As it goes I'm struggling to get option 2 to work at all). Can anyone tell me what is the best way to achieve this?

    要澄清,我想:

  • 拥有的所有页面重定向到即将-soon.html (即 www.mywebsite/sample-page.html 的=> www.mywebsite/coming-soon.html 的)
  • 添加例外 /contact-us.html 使这一请求被正常处理(即 www.mywebsite/contact-us html的 =>的 www.mywebsite/contact-us.html 的)
  • Have all pages redirect to coming-soon.html (i.e. www.mywebsite/sample-page.html => www.mywebsite/coming-soon.html)
  • Add an exception for /contact-us.html so that this request is processed normally (i.e. www.mywebsite/contact-us.html => www.mywebsite/contact-us.html)
  • 感谢您的帮助,我是相当新的的.htaccess!

    Thanks for any help, I'm rather new to .htaccess!

    推荐答案

    您可以尝试这样的:

    RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !contact-us.html [NC] RewriteCond %{REQUEST_URI} !coming-soon.html [NC] RewriteCond %{REQUEST_URI} \.(html|htm)/? [NC] RewriteRule .* coming-soon.html [R=301,L]

    更多推荐

    最好的办法,为的.htaccess临时重定向(302)与异常

    本文发布于:2023-11-01 23:24:41,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1550708.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:最好的   重定向   异常   办法   htaccess

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!