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

TYPO3 v4.7更换域名后realurl失效问题求助

Fixing Friendly URLs (page-name) After TYPO3 4.7 Domain Migration

I’ve handled plenty of TYPO3 4.x migration issues before, and this scenario (friendly URLs returning 404 but ID-based URLs working) almost always boils down to URL rewrite or friendly URL parsing misconfigurations. Let’s walk through the fixes step by step:

1. Verify .htaccess Configuration

TYPO3 4.7 relies on Apache’s mod_rewrite (or equivalent Nginx rules) to route friendly URLs to index.php.

  • First, confirm mod_rewrite is enabled on your new server: Check via phpinfo(), or reach out to your host if unsure.
  • Open the .htaccess file in your site root and verify these key settings:
    • RewriteBase is set correctly for your new domain’s root path (use RewriteBase / for root directories, adjust if your site lives in a subfolder).
    • The core rewrite rules are present:
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php [L]
      
  • Ensure your Apache virtual host config has AllowOverride All enabled—this lets .htaccess rules take effect.

2. Check RealURL Extension Settings (Most Likely Culprit)

TYPO3 4.7 almost exclusively uses the RealURL extension for friendly URLs, and domain migrations often break its config/cache:

  • Update the RealURL config file:
    Open typo3conf/realurl_conf.php and replace any references to your old domain with the new one. Make sure the default config block targets your new site:
    $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'] = array(
        'init' => array(
            'enableCHashCache' => true,
            'appendMissingSlash' => 'ifNotFile',
            'enableUrlCache' => true,
        ),
        'pagePath' => array(
            'type' => 'user',
            'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
            'spaceCharacter' => '-',
            'rootpage_id' => '1', // Confirm this matches your site's root page ID
        ),
        'fileName' => array(
            'acceptHTMLsuffix' => true,
        ),
        // Delete or modify any old domain-specific config blocks here
    );
    
  • Clear RealURL’s cached URL mappings:
    RealURL stores old URL paths in the database, so we need to reset this:
    1. In the TYPO3 backend, go to Admin Tools > DB Check, find tables tx_realurl_uniqalias and tx_realurl_pathcache, and empty their contents.
    2. Or run these SQL queries directly:
      TRUNCATE TABLE tx_realurl_uniqalias;
      TRUNCATE TABLE tx_realurl_pathcache;
      

3. Validate TYPO3 Frontend Configuration

Double-check TYPO3’s core frontend settings to ensure they support friendly URLs:

  • In the TYPO3 backend, go to Admin Tools > Configuration and navigate to the [FE] section:
    • Set simulateStaticDocuments to 0 (this conflicts with RealURL and must be disabled).
    • Ensure absRefPrefix is set to / (or your site’s root path if it’s in a subfolder).
    • Confirm tx_realurl_enable is set to 1 to activate the extension.
  • You can also verify these settings directly in typo3conf/LocalConfiguration.php:
    'FE' => array(
        'absRefPrefix' => '/',
        'simulateStaticDocuments' => '0',
    ),
    'EXTCONF' => array(
        'realurl' => array(
            'enable' => '1',
        ),
    ),
    

4. Flush All TYPO3 Caches

Caches are a common culprit in migration issues—clear everything to refresh configurations:

  • Click the Flush all caches button in the TYPO3 backend’s top toolbar (this clears page, config, and extension caches).
  • Manually delete all files/folders inside typo3temp/ (leave the directory itself intact).

5. Nginx-Specific Check (If Using Nginx)

If your new server runs Nginx instead of Apache, replace .htaccess with these rewrite rules in your server block:

location / {
    try_files $uri $uri/ /index.php?$args;
}

# Block access to sensitive TYPO3 files
location ~* \.(typo3|tsconfig|ts|sql)$ {
    deny all;
}

After completing these steps, test your friendly URLs again—they should load normally. If issues persist, you can check RealURL’s current configuration by visiting index.php?eID=tx_realurl&cmd=showconf to confirm your new domain is being recognized correctly.


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.14 08:56:58