[Frage] RealURL weiterleitung von IDs funktioniert nicht TYPO3-Version: 6.2.1

  • mattx7 mattx7
    T3PO
    0 x
    11 Beiträge
    0 Hilfreiche Beiträge
    11. 04. 2016, 12:06

    Hallo,
    ich habe das Problem, dass RealURL z.B. Adressen von

    /index.php?id=24&L=0
    nicht automatisch in
    /impressum.html
    umwandelt und damit doppelter Content entsteht.

    Ich habe alles nach der Anleitung von RealURL konfiguriert und auch die beiliegenden Befehler für die .htaccess übernommen aber nichts funktioniert.

    Um schon mal im Vorraus eine Fehlerquelle auszuschließen, die Weiterleitung von http://www.domain.de zu domain.de funktioniert.

    realurl_config.php:

    1. <?php
    2. $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'] = array(
    3. 'init' => array(
    4. 'enableCHashCache' => true,
    5. // 'appendMissingSlash' => 'ifNotFile',
    6. 'enableUrlDecodeCache' => true,
    7. 'enableUrlEncodeCache' => true,
    8. ),
    9. 'preVars' => array(
    10. 'GETvar' => 'L',
    11. 'valueMap' => array(
    12. #'de' => '0'
    13. 'en' => '1',
    14. ),
    15. 'noMatch' => 'bypass',
    16. ),
    17. ),
    18. 'fileName' => array (
    19. 'defaultToHTMLsuffixOnPrev' => '1',
    20. 'index' => array(
    21. 'print.html' => array(
    22. 'keyValues' => array (
    23. 'type' => 98,
    24. )
    25. ),
    26. '_DEFAULT' => array(
    27. 'keyValues' => array(
    28. )
    29. ),
    30. ),
    31. ),
    32. 'pagePath' => array(
    33. 'spaceCharacter' => '-',
    34. 'expireDays' => '3',
    35. 'rootpage_id' => '1',
    36. ),
    37. 'postVarSets' => array(
    38. '_DEFAULT' => array (
    39. 'page' => array(
    40. 'GETvar' => 'tx_news_pi1[@widget_0][currentPage]',
    41. ),
    42. ),
    43. /*'news-artikel' => array(
    44. array(
    45.   'GETvar' => 'tx_news_pi1[controller]',
    46.   ),
    47. array(
    48.   'GETvar' => 'tx_news_pi1[action]',
    49.   ),
    50. array(
    51.   'GETvar' => 'tx_news_pi1[news]',
    52. 'lookUpTable' => array(
    53. 'table' => 'tx_news_domain_model_news',
    54. 'id_field' => 'uid',
    55. 'alias_field' => 'title',
    56. 'addWhereClause' => 'AND NOT deleted',
    57. 'useUniqueCache' => 1,
    58. 'useUniqueCache_conf' => array(
    59. 'strtolower' => 1,
    60. 'spaceCharacter' => '_'
    61. ),
    62. ),
    63.   ),
    64.   ),*/
    65. ),
    66. ),
    67. 'fixedPostVars' => array(
    68. 'fixedNewsArtikle' => array(
    69. 'GETvar' => 'tx_news_pi1[controller]',
    70. 'valueMap' => array(),
    71. 'noMatch' => 'bypass',
    72. ),
    73. 'GETvar' => 'tx_news_pi1[action]',
    74. 'valueMap' => array(),
    75. 'noMatch' => 'bypass',
    76. ),
    77. 'GETvar' => 'tx_news_pi1[news]',
    78. 'lookUpTable' => array(
    79. 'table' => 'tx_news_domain_model_news',
    80. 'id_field' => 'uid',
    81. 'alias_field' => 'title',
    82. 'addWhereClause' => 'AND NOT deleted',
    83. 'useUniqueCache' => 1,
    84. 'useUniqueCache_conf' => array(
    85. 'strtolower' => 1,
    86. 'spaceCharacter' => '_'
    87. ),
    88. ),
    89. ),
    90. ),
    91. '136' => 'fixedNewsArtikle', //136 = PageID von News-Artikeln
    92. ),
    93. );
    94. ?>

    .htaccess:

    1. #####
    2. #
    3. # Example .htaccess file for TYPO3 CMS - for use with Apache Webserver
    4. #
    5. # This file includes settings for the following configuration options:
    6. #
    7. # - Compression
    8. # - Caching
    9. # - MIME types
    10. # - Cross Origin requests
    11. # - Rewriting and Access
    12. # - Miscellaneous
    13. # - PHP optimisation
    14. #
    15. # If you want to use it, you have to copy it to the root folder of your TYPO3 installation (if its
    16. # not there already) and rename it to '.htaccess'. To make .htaccess files work, you might need to
    17. # adjust the 'AllowOverride' directive in your Apache configuration file.
    18. #
    19. # IMPORTANT: You may need to change this file depending on your TYPO3 installation!
    20. # Consider adding this file's content to your webserver's configuration directly for speed improvement
    21. #
    22. # Lots of the options are taken from https://github.com/h5bp/html5-boilerplate/blob/master/dist/.htaccess
    23. #
    24. #
    25. #
    26. #
    27. #
    28. #
    29. #
    30. # Begin: Compression
    31. #
    32. #
    33. #
    34. # Compressing resource files will save bandwidth and so improve loading speed especially for users
    35. # with slower internet connections. TYPO3 can compress the .js and .css files for you.
    36. # *) Uncomment the following lines and
    37. # *) Set $GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel'] = 9 for the Backend
    38. # *) Set $GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel'] = 9 together with the TypoScript properties
    39. # config.compressJs and config.compressCss for GZIP compression of Frontend JS and CSS files.
    40. #<FilesMatch "\.js\.gzip$">
    41. # AddType "text/javascript" .gzip
    42. #</FilesMatch>
    43. #<FilesMatch "\.css\.gzip$">
    44. # AddType "text/css" .gzip
    45. #</FilesMatch>
    46. #AddEncoding gzip .gzip
    47. <IfModule mod_deflate.c>
    48. # Force compression for mangled `Accept-Encoding` request headers
    49. <IfModule mod_setenvif.c>
    50. <IfModule mod_headers.c>
    51. SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
    52. RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
    53. </IfModule>
    54. </IfModule>
    55.  
    56. # Compress all output labeled with one of the following media types
    57. <IfModule mod_filter.c>
    58. AddOutputFilterByType DEFLATE application/atom+xml \
    59. application/javascript \
    60. application/json \
    61. application/ld+json \
    62. application/manifest+json \
    63. application/rdf+xml \
    64. application/rss+xml \
    65. application/schema+json \
    66. application/vnd.geo+json \
    67. application/vnd.ms-fontobject \
    68. application/x-font-ttf \
    69. application/x-javascript \
    70. application/x-web-app-manifest+json \
    71. application/xhtml+xml \
    72. application/xml \
    73. font/eot \
    74. font/opentype \
    75. image/bmp \
    76. image/svg+xml \
    77. image/vnd.microsoft.icon \
    78. image/x-icon \
    79. text/cache-manifest \
    80. text/css \
    81. text/html \
    82. text/javascript \
    83. text/plain \
    84. text/vcard \
    85. text/vnd.rim.location.xloc \
    86. text/vtt \
    87. text/x-component \
    88. text/x-cross-domain-policy \
    89. text/xml
    90. </IfModule>
    91.  
    92. <IfModule mod_mime.c>
    93. AddEncoding gzip svgz
    94. </IfModule>
    95. </IfModule>
    96.  
    97. ### End: Compression ###
    98.  
    99.  
    100.  
    101. ### Begin: Browser caching of resource files ###
    102.  
    103. # This affects Frontend and Backend and increases performance.
    104. <IfModule mod_expires.c>
    105.  
    106. ExpiresActive on
    107. ExpiresDefault "access plus 1 month"
    108.  
    109. ExpiresByType text/css "access plus 1 year"
    110.  
    111. ExpiresByType application/json "access plus 0 seconds"
    112. ExpiresByType application/ld+json "access plus 0 seconds"
    113. ExpiresByType application/schema+json "access plus 0 seconds"
    114. ExpiresByType application/vnd.geo+json "access plus 0 seconds"
    115. ExpiresByType application/xml "access plus 0 seconds"
    116. ExpiresByType text/xml "access plus 0 seconds"
    117.  
    118. ExpiresByType image/vnd.microsoft.icon "access plus 1 week"
    119. ExpiresByType image/x-icon "access plus 1 week"
    120.  
    121. ExpiresByType text/x-component "access plus 1 month"
    122.  
    123. ExpiresByType text/html "access plus 0 seconds"
    124.  
    125. ExpiresByType application/javascript "access plus 1 year"
    126. ExpiresByType application/x-javascript "access plus 1 year"
    127. ExpiresByType text/javascript "access plus 1 year"
    128.  
    129. ExpiresByType application/manifest+json "access plus 1 week"
    130. ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
    131. ExpiresByType text/cache-manifest "access plus 0 seconds"
    132.  
    133. ExpiresByType audio/ogg "access plus 1 month"
    134. ExpiresByType image/bmp "access plus 1 month"
    135. ExpiresByType image/gif "access plus 1 month"
    136. ExpiresByType image/jpeg "access plus 1 month"
    137. ExpiresByType image/png "access plus 1 month"
    138. ExpiresByType image/svg+xml "access plus 1 month"
    139. ExpiresByType image/webp "access plus 1 month"
    140. ExpiresByType video/mp4 "access plus 1 month"
    141. ExpiresByType video/ogg "access plus 1 month"
    142. ExpiresByType video/webm "access plus 1 month"
    143.  
    144. ExpiresByType application/atom+xml "access plus 1 hour"
    145. ExpiresByType application/rdf+xml "access plus 1 hour"
    146. ExpiresByType application/rss+xml "access plus 1 hour"
    147.  
    148. ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
    149. ExpiresByType font/eot "access plus 1 month"
    150. ExpiresByType font/opentype "access plus 1 month"
    151. ExpiresByType application/x-font-ttf "access plus 1 month"
    152. ExpiresByType application/font-woff "access plus 1 month"
    153. ExpiresByType application/x-font-woff "access plus 1 month"
    154. ExpiresByType font/woff "access plus 1 month"
    155. ExpiresByType application/font-woff2 "access plus 1 month"
    156.  
    157. ExpiresByType text/x-cross-domain-policy "access plus 1 week"
    158.  
    159. </IfModule>
    160.  
    161. ### End: Browser caching of resource files ###
    162.  
    163.  
    164. ### Begin: MIME types ###
    165.  
    166. # Proper MIME types for all files
    167. <IfModule mod_mime.c>
    168.  
    169. # Data interchange
    170. AddType application/atom+xml atom
    171. AddType application/json json map topojson
    172. AddType application/ld+json jsonld
    173. AddType application/rss+xml rss
    174. AddType application/vnd.geo+json geojson
    175. AddType application/xml rdf xml
    176.  
    177. # JavaScript
    178. AddType application/javascript js
    179.  
    180. # Manifest files
    181. AddType application/manifest+json webmanifest
    182. AddType application/x-web-app-manifest+json webapp
    183. AddType text/cache-manifest appcache
    184.  
    185. # Media files
    186.  
    187. AddType audio/mp4 f4a f4b m4a
    188. AddType audio/ogg oga ogg opus
    189. AddType image/bmp bmp
    190. AddType image/svg+xml svg svgz
    191. AddType image/webp webp
    192. AddType video/mp4 f4v f4p m4v mp4
    193. AddType video/ogg ogv
    194. AddType video/webm webm
    195. AddType video/x-flv flv
    196. AddType image/x-icon cur ico
    197.  
    198. # Web fonts
    199. AddType application/font-woff woff
    200. AddType application/font-woff2 woff2
    201. AddType application/vnd.ms-fontobject eot
    202. AddType application/x-font-ttf ttc ttf
    203. AddType font/opentype otf
    204.  
    205. # Other
    206. AddType application/octet-stream safariextz
    207. AddType application/x-bb-appworld bbaw
    208. AddType application/x-chrome-extension crx
    209. AddType application/x-opera-extension oex
    210. AddType application/x-xpinstall xpi
    211. AddType text/vcard vcard vcf
    212. AddType text/vnd.rim.location.xloc xloc
    213. AddType text/vtt vtt
    214. AddType text/x-component htc
    215.  
    216. </IfModule>
    217.  
    218. # UTF-8 encoding
    219. AddDefaultCharset utf-8
    220. <IfModule mod_mime.c>
    221. AddCharset utf-8 .atom .css .js .json .manifest .rdf .rss .vtt .webapp .webmanifest .xml
    222. </IfModule>
    223.  
    224. ### End: MIME types ###
    225.  
    226.  
    227.  
    228. ### Begin: Cross Origin ###
    229.  
    230. # Send the CORS header for images when browsers request it.
    231. <IfModule mod_setenvif.c>
    232. <IfModule mod_headers.c>
    233. <FilesMatch "\.(bmp|cur|gif|ico|jpe?g|png|svgz?|webp)$">
    234. SetEnvIf Origin ":" IS_CORS
    235. Header set Access-Control-Allow-Origin "*" env=IS_CORS
    236. </FilesMatch>
    237. </IfModule>
    238. </IfModule>
    239.  
    240. # Allow cross-origin access to web fonts.
    241. <IfModule mod_headers.c>
    242. <FilesMatch "\.(eot|otf|tt[cf]|woff2?)$">
    243. Header set Access-Control-Allow-Origin "*"
    244. </FilesMatch>
    245. </IfModule>
    246.  
    247. ### End: Cross Origin ###
    248.  
    249.  
    250.  
    251. ### Begin: Rewriting and Access ###
    252.  
    253. # You need rewriting, if you use a URL-Rewriting extension (RealURL, CoolUri).
    254.  
    255. <IfModule mod_rewrite.c>
    256.  
    257. # Enable URL rewriting
    258. RewriteEngine On
    259.  
    260. # Store the current location in an environment variable CWD to use
    261. # mod_rewrite in .htaccess files without knowing the RewriteBase
    262. RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
    263. RewriteRule ^.*$ - [E=CWD:%2]
    264.  
    265. # Rules to set ApplicationContext based on hostname
    266. #RewriteCond %{HTTP_HOST} ^dev\.example\.com$
    267. #RewriteRule .? - [E=TYPO3_CONTEXT:Development]
    268. #RewriteCond %{HTTP_HOST} ^staging\.example\.com$
    269. #RewriteRule .? - [E=TYPO3_CONTEXT:Production/Staging]
    270. #RewriteCond %{HTTP_HOST} ^www\.example\.com$
    271. #RewriteRule .? - [E=TYPO3_CONTEXT:Production]
    272.  
    273. # Rule for versioned static files, configured through:
    274. # - $GLOBALS['TYPO3_CONF_VARS']['BE']['versionNumberInFilename']
    275. # - $GLOBALS['TYPO3_CONF_VARS']['FE']['versionNumberInFilename']
    276. # IMPORTANT: This rule has to be the very first RewriteCond in order to work!
    277. RewriteCond %{REQUEST_FILENAME} !-f
    278. RewriteCond %{REQUEST_FILENAME} !-d
    279. RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]
    280.  
    281. # Access block for folders
    282. RewriteRule _(?:recycler|temp)_/ - [F]
    283. RewriteRule fileadmin/templates/.*\.(?:txt|ts)$ - [F]
    284. RewriteRule typo3temp/logs/ - [F]
    285. RewriteRule (?:typo3conf/ext|typo3/sysext|typo3/ext|typo3/vendor)/[^/]+/(?:Configuration|Resources/Private|Tests?)/ - [F]
    286.  
    287. # Block access to all hidden files and directories with the exception of
    288. # the visible content from within the `/.well-known/` hidden directory (RFC 5785).
    289. RewriteCond %{REQUEST_URI} "!(^|/)\.well-known/([^./]+./?)+$" [NC]
    290. RewriteCond %{SCRIPT_FILENAME} -d [OR]
    291. RewriteCond %{SCRIPT_FILENAME} -f
    292. RewriteRule (?:^|/)\. - [F]
    293.  
    294. # Stop rewrite processing, if we are in the typo3/ directory or any other known directory
    295. # NOTE: Add your additional local storages here
    296. RewriteRule (?:typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
    297.  
    298. # If the file/symlink/directory does not exist => Redirect to index.php.
    299. # For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'.
    300.  
    301. RewriteCond %{REQUEST_FILENAME} !-f
    302. RewriteCond %{REQUEST_FILENAME} !-d
    303. RewriteCond %{REQUEST_FILENAME} !-l
    304. RewriteRule .* index.php
    305.  
    306. RewriteCond %{HTTP_HOST} ^www\.copy\.domain\.de$ [NC]
    307. RewriteRule ^(.*)$ http://copy.domain.de/$1 [R=301,L]
    308. </IfModule>
    309.  
    310. # Access block for files
    311. <FilesMatch "(?i:^\.|^#.*#|^(?:ChangeLog|ToDo|Readme|License)(?:\.md|\.txt)?|^composer\.(?:json|lock)|^ext_conf_template\.txt|^ext_typoscript_constants\.txt|^ext_typoscript_setup\.txt|flexform[^.]*\.xml|locallang[^.]*\.(?:xml|xlf)|\.(?:bak|co?nf|cfg|ya?ml|ts|dist|fla|in[ci]|log|sh|sql(?:\..*)?|sw[op]|git.*)|.*(?:~|rc))$">
    312. # Apache < 2.3
    313. <IfModule !mod_authz_core.c>
    314. Order allow,deny
    315. Deny from all
    316. Satisfy All
    317. </IfModule>
    318.  
    319. # Apache = 2.3
    320. <IfModule mod_authz_core.c>
    321. Require all denied
    322. </IfModule>
    323. </FilesMatch>
    324.  
    325. # Block access to vcs directories
    326. <IfModule mod_alias.c>
    327. RedirectMatch 404 /\.(?:git|svn|hg)/
    328. </IfModule>
    329.  
    330. ### End: Rewriting and Access ###
    331.  
    332.  
    333.  
    334. ### Begin: Miscellaneous ###
    335.  
    336. # 404 error prevention for non-existing redirected folders
    337. Options -MultiViews
    338.  
    339. # Make sure that directory listings are disabled.
    340. <IfModule mod_autoindex.c>
    341. Options -Indexes
    342. </IfModule>
    343.  
    344. <IfModule mod_headers.c>
    345. # Force IE to render pages in the highest available mode
    346. Header set X-UA-Compatible "IE=edge"
    347. <FilesMatch "\.(appcache|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svgz?|ttf|vcf|webapp|webm|webp|woff2?|xml|xpi)$">
    348. Header unset X-UA-Compatible
    349. </FilesMatch>
    350.  
    351. # Reducing MIME type security risks
    352. Header set X-Content-Type-Options "nosniff"
    353. </IfModule>
    354.  
    355. # ETag removal
    356. <IfModule mod_headers.c>
    357. Header unset ETag
    358. </IfModule>
    359. FileETag None
    360.  
    361. ### End: Miscellaneous ###
    362.  
    363.  
    364. # Add your own rules here.

    TypoScript:

    1. config {
    2. prefixLocalAnchors = all
    3. tx_realurl_enable = 1
    4. baseURL = http://copy.domain.de/
    5. absRefPrefix = http://copy.domain.de/
    6. # dont forget to set the allowed range, here 0-3; otherwise anything else could be inserted
    7. linkVars = L(0-1)
    8. }

  • Hilfreichster Beitrag

  • Julian.Hofmann Julian.Ho...
    Flash Gordon
    1 x
    3078 Beiträge
    132 Hilfreiche Beiträge
    12. 04. 2016, 08:40 - Hilfreichster Beitrag

    Oder meinst Du, dass Deine Seiten [b]auch[/b] über die nicht-sprechenden URLs aufrufbar ist? Das lässt sich nicht vermeiden,w eil es die "normale", technische Schreibweise ist.
    Gegen den Duplicate Content lässt sich aber mittels passender robots.txt vorgehen. Oliver hat dazu eine gute Vorlage bereitgestellt: https://gist.github.com/oliverthiele/83957820413fd981e062


  • 1
  • Julian.Hofmann Julian.Ho...
    Flash Gordon
    0 x
    3078 Beiträge
    132 Hilfreiche Beiträge
    12. 04. 2016, 08:33

    Hallo.

    Zieht sich die fehlende Umwandlung durch alle Linkgenerierungen durch? D.h. egal, ob es ein von Dir via TypoScript erzeugter Link ist oder ein Link im RTE oder im Menü?

    Zweite Idee: kommentiere mal <IfModule mod_rewrite.c> und zugehöriges schließendes Tag aus. Gelegentlich wird das nicht unterstützt.

    Viele Grüße
    Julian

  • Julian.Hofmann Julian.Ho...
    Flash Gordon
    1 x
    3078 Beiträge
    132 Hilfreiche Beiträge
    12. 04. 2016, 08:40

    Oder meinst Du, dass Deine Seiten [b]auch[/b] über die nicht-sprechenden URLs aufrufbar ist? Das lässt sich nicht vermeiden,w eil es die "normale", technische Schreibweise ist.
    Gegen den Duplicate Content lässt sich aber mittels passender robots.txt vorgehen. Oliver hat dazu eine gute Vorlage bereitgestellt: https://gist.github.com/oliverthiele/83957820413fd981e062

  • mattx7 mattx7
    T3PO
    0 x
    11 Beiträge
    0 Hilfreiche Beiträge
    14. 04. 2016, 10:25

    Danke für deine Hilfe!
    Dann hatte ich die Möglichkeiten von RealURL falsch eingeschätzt. Ich dachte die "/index.php?id=???" lassen sich auch auf die neuen URLs umleiten aber wenn ich diese in der robots.txt verbieten kann reicht mir das völlig aus. :)

    Ich muss mich noch für das mehrfach Posten dieser Frage entschuldigen. Ich habe beim Abschicken eine Fehlermeldung bekommen und bin eigentlich davon ausgegangen noch garnichts abgesendet zu haben. Umso mehr habe ich mich aber darüber gefreut schon eine Antwort auf eine eigentlich nicht gestellte Frage zu haben :D

  • Julian.Hofmann Julian.Ho...
    Flash Gordon
    0 x
    3078 Beiträge
    132 Hilfreiche Beiträge
    20. 04. 2016, 09:25

    Mehrfachpostings sind leider nicht ganz untypisch. Da hängt immer mal wieder irgendwas in der Technik dieses Forums :(

  • 1