admin管理员组文章数量:1277896
My wordpress use custom permalinks url with rules /%postname%.html
And Htaccess rules
# This file was updated by Duplicator Pro on 2021-11-02 05:53:04.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
So my post url looks like this (with amp plugin)
.html
<--- original url
.html/amp
<--- amp url
.html/amp/
<--- amp url
.html?amp
<--- amp url
.html?amp=1
<--- amp url
I have disabled amp plugin recently , this leave me with thousand not found url from previous amp url ..and i used solution provided on this answer
so my htaccess looks like this
# This file was updated by Duplicator Pro on 2021-11-02 05:53:04.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} (.+)/amp(.*)$
RewriteRule ^ %1/ [R=301,L]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
But then i moved from shared hosting to vps (centos 7) ..using the same rules, now it add additional slash in url .html/
where it should be .html
Request
> GET /post.html/amp/ HTTP/1.1
> Host: www.host
> User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246
Response
< HTTP/1.1 301 Moved Permanently
< Date: Thu, 04 Nov 2021 07:43:16 GMT
< Content-Type: text/html; charset=iso-8859-1
< Content-Length: 274
< Connection: keep-alive
< location: .html/
< cache-control: max-age=0
< expires: Thu, 04 Nov 2021 07:43:16 GMT
< CF-Cache-Status: DYNAMIC
< Server: cloudflare
my apology if i post to long question, but i need help to redirect /amp
/amp/
?amp
?amp=1
?amp=0
to original non amp url
Thank you
本文标签: redirectRedirecting amp url to non amp url
版权声明:本文标题:redirect - Redirecting amp url to non amp url 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741234249a2362688.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论