TYPO3 6.2站点的.htaccess有两个URL重写块(等等)
# 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]
如何强制后端的www(/typo3
,/typo3/
,typo3/index.php
)?
我尝试了类似RewriteRule ^typo3(.*)?$ http://www.%{HTTP_HOST}/typo3/$1 [R=301,L]
的内容,但只有错误。
^typo3$
。所以也许我甚至不需要强制www,但澄清为什么重写不会停止它应该在哪里。
答案 0 :(得分:1)
重新排序您的规则:
# 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]