简体   繁体   中英

TYPO3 9.5.20 .htaccess redirect - too many redirects

I am trying to redirect all pages to /uk apart from the home page and the /uk page but I get localhost redirected you too many times when it loads the /uk page. I thought !^/uk$ would solve this. Any help is greatly appreciated

Here is my code in the .htaccess file;

# Add your own rules here.
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} !^/$ [NC]
    RewriteCond %{REQUEST_URI} !^/uk$ [NC]
    RewriteCond %{HTTP_COOKIE} !cookieConfirmed=1;? [NC]
    RewriteRule . /uk [L,R=301]
</IfModule>

These should work:

RewriteCond %{REQUEST_URI} !^/$ [NC]
RewriteCond %{REQUEST_URI} !^/uk/?$ [NC]
RewriteRule ^(.*) /uk [L,R=301]

Maybe you added a slash to all URLs so the too many redirects occurs? So I made a / at the end optional.

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