Redirect Loop Occurs in Wordpress

Asked 2 years ago, Updated 2 years ago, 59 views

I would like to redirect the site with ?amp at the end of url when I access it with my smartphone, but when I access it with my smartphone, there is a loop.
Could you tell me where the problem is?

The code is as follows:

RewriteEngine on
RewriteCond%{HTTPS} off
RewriteRule^(.*)$https://%{HTTP_HOST}%{REQUEST_URI}[R=301,L]

RewriteEngine on
RewriteCond%{REQUEST_URI}!\?amp
RewriteCond%{HTTP_USER_AGENT} (iPod|iPhone|iPhone|iPhone|Android|Windows\Phone)
RewriteRule^(.*)$1\?amp[R=301,L]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule^index\.php$ - [L]
US>RewriteCon%{REQUEST_FILENAME}!-f
RewriteCon%{REQUEST_FILENAME}!-d
RewriteRule./index.php [L]
</IfModule>

# END WordPress

apache .htaccess

2022-09-30 17:04

1 Answers

The query string amamp は is set to %{QUERY_STRING} instead of %{REQUEST_URI}.


2022-09-30 17:04

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.