TYPO3 v4.7更换域名后realurl失效问题求助
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_rewriteis enabled on your new server: Check via phpinfo(), or reach out to your host if unsure. - Open the
.htaccessfile in your site root and verify these key settings:RewriteBaseis set correctly for your new domain’s root path (useRewriteBase /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 Allenabled—this lets.htaccessrules 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:
Opentypo3conf/realurl_conf.phpand 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:- In the TYPO3 backend, go to Admin Tools > DB Check, find tables
tx_realurl_uniqaliasandtx_realurl_pathcache, and empty their contents. - Or run these SQL queries directly:
TRUNCATE TABLE tx_realurl_uniqalias; TRUNCATE TABLE tx_realurl_pathcache;
- In the TYPO3 backend, go to Admin Tools > DB Check, find tables
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
simulateStaticDocumentsto0(this conflicts with RealURL and must be disabled). - Ensure
absRefPrefixis set to/(or your site’s root path if it’s in a subfolder). - Confirm
tx_realurl_enableis set to1to activate the extension.
- Set
- 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

