The .htaccess for a TYPO3 6.2 site has those two URL rewriting blocks (among others)
# Regular TYPO3 / RealURL rewrites
RewriteEngine On
RewriteRule ^typo3$ - [L]
RewriteRule ^typo3/.*$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php
# force www for frontend to avoid duplicate content
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]
How can I force the www for the backend ( /typo3
, /typo3/
, typo3/index.php
) as well?
I've tried things like RewriteRule ^typo3(.*)?$ http://www.%{HTTP_HOST}/typo3/$1 [R=301,L]
but only got errors.
^typo3$
. So maybe I don't even need to force www, but clarify why the rewriting doesn't stop where it should.
Not sure if related: https://forge.typo3.org/issues/65705
Reorder your rules like this:
# Regular TYPO3 / RealURL rewrites
RewriteEngine On
# force www for frontend to avoid duplicate content
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
RewriteRule ^typo3(/.*)?$ - [L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^ index.php [L]
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.