简体   繁体   中英

typo3: realurl extension- configuration issue, include path-fragment in url

Assume I have a website www.mywebsite.com. My typo3 v4.7 frontend is located at, say,

www.mywebsite.com/cms/index.php

, and the backend is located at www.mywebsite.com/cms/typo3/.

How do I configure the "friendly" urls, that the realurl extension generates, in a way that urls are mapped as follows:

www.mywebsite.com/cms/index.php?id=45

to

www.mywebsite.com/cms/something

I want to use the autoconfiguration feature of realurl.

This is how the autoconfig file looks like:

<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array (
  '_DEFAULT' => 
  array (
    'init' => 
    array (
      'enableCHashCache' => true,
      'appendMissingSlash' => 'ifNotFile,redirect',
      'adminJumpToBackend' => true,
      'enableUrlDecodeCache' => true,
      'enableUrlEncodeCache' => true,
      'emptyUrlReturnValue' => '/cms/',
    ),
    'pagePath' => 
    array (
      'type' => 'user',
      'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
      'spaceCharacter' => '-',
      'languageGetVar' => 'L',
      'rootpage_id' => '13',
    ),
    'fileName' => 
    array (
      'defaultToHTMLsuffixOnPrev' => 0,
      'acceptHTMLsuffix' => 1,
      'index' => 
      array (
        'print' => 
        array (
          'keyValues' => 
          array (
            'type' => 98,
          ),
        ),
      ),
    ),
  ),
);
?>

I can't get it done. There are more virtual hosts on this website. I don't want to build a new dedicated virtual host just for this typ3 installation.

Currently, redirects do not work. There is a generic with a "Page ... was not found on this server." error-message issued by Apache.

<IfModule mod_rewrite.c>

        RewriteEngine on
        #RewriteBase /cms/
       RewriteRule ^/cms/(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic\.php)(/.*)?$ - [L]
</IfModule> 

I think your problem has currently nothing to do with RealURL and its configuration. You have a problem with mod_rewrite configuration. Start with the original one that is shipped with TYPO3 because the bit you posted is missing crucial rules. Try to set the RewriteBase but if it doesn't work, disable it.

Note that it's actually the last rule ( RewriteRule .* index.php [L] ) that invokes TYPO3 and makes it handle the request, which apparently doesn't happen right now.

<IfModule mod_rewrite.c>

# Enable URL rewriting
RewriteEngine On

# Change this path, if your TYPO3 installation is located in a subdirectory of the website root.
RewriteBase /cms/

# Rule for versioned static files, configured through:
# - $TYPO3_CONF_VARS['BE']['versionNumberInFilename']
# - $TYPO3_CONF_VARS['FE']['versionNumberInFilename']
# IMPORTANT: This rule has to be the very first RewriteCond in order to work!
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]

# Stop rewrite processing, if we are in the typo3/ directory.
# For httpd.conf, use this line instead of the next one:
# RewriteRule ^/TYPO3root/(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
RewriteRule ^(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]

# Redirect http://example.com/typo3 to http://example.com/typo3/index_re.php and stop the rewrite processing.
# For httpd.conf, use this line instead of the next one:
# RewriteRule ^/TYPO3root/typo3$ /TYPO3root/typo3/index.php [L]
RewriteRule ^typo3$ typo3/index_re.php [L]

# If the file/symlink/directory does not exist => Redirect to index.php.
# For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

# Main URL rewriting.
# For httpd.conf, use this line instead of the next one:
# RewriteRule .* /TYPO3root/index.php [L]
RewriteRule .* index.php [L]

</IfModule>

Just a tip: instead using TYPO3 in subfolder it's much more comfortable to put it into subdomain like cms.mydomain.com . In such case you don't need an additional re-configuration, and all elements works as it was normal domain.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM