You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TYPO3 6.2:禁用页面时如何实现301重定向至首页?

Fixing 301 Redirect for Disabled TYPO3 6.2 Page Instead of 404

Hey there! Let's sort out this TYPO3 6.2 issue you're dealing with—getting that hidden (disabled) page to return a 301 redirect to your homepage instead of a 404 is totally doable, and it’ll let you keep developing while fixing the Google indexing problem. Here are the most reliable methods tailored to your version:

Method 1: Global TypoScript (Affects All Disabled Pages)

If you want every disabled page to redirect to the homepage, use your root template’s TypoScript setup:

  1. Head to the Template module in the TYPO3 backend.
  2. Select your root template and edit its Setup section.
  3. Paste this code:
# Trigger redirect only for hidden pages
[page["hidden"] == 1]
    # Send 301 permanent redirect header
    config.additionalHeaders = HTTP/1.1 301 Moved Permanently
    config.additionalHeaders.location = /
    # Ensure TYPO3 doesn’t render any extra content
    config.sendCacheHeaders = 1
    page = PAGE
    page.typeNum = 0
    page.config.disableAllHeaderCode = 1
    page.body >
[end]
  1. Clear TYPO3’s system cache (you can do this from the top toolbar’s cache icon) to apply the changes.

Method 2: Page-Specific TSconfig (Only Target Your Problem Page)

If you only need this redirect for that one special page (and leave other disabled pages as 404), use page-level TSconfig:

  1. Go to the disabled page’s properties in the Page module.
  2. Switch to the Resources tab, then find the Page TSconfig field.
  3. Replace YOUR_PAGE_ID with the ID of your disabled page and add this code:
[globalVar = TSFE:id = YOUR_PAGE_ID]
    config.additionalHeaders = HTTP/1.1 301 Moved Permanently
    config.additionalHeaders.location = /
    config.sendCacheHeaders = 1
    page = PAGE
    page.typeNum = 0
    page.config.disableAllHeaderCode = 1
    page.body >
[end]
  1. Again, clear the cache to make sure the change takes effect.

Bonus: Clean Up Google’s Index

Once the redirect is working, head over to Google Search Console (if you have it set up) and submit a URL removal request for the indexed disabled page. This will speed up Google’s process of removing it from search results.

Alternative: .htaccess Redirect

If you prefer server-level changes, you can add this line to your site’s .htaccess file (replace /your-disabled-page-url with the actual URL of the page):

Redirect 301 /your-disabled-page-url /

Just note that this method won’t tie into TYPO3’s page hidden status—you’ll need to update the .htaccess if the page URL changes later.

内容的提问来源于stack exchange,提问作者Paolito75

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 07:14:27