News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Fixing URL encoded entities in URL

Started by spiros, November 12, 2020, 01:22:34 AM

Previous topic - Next topic

spiros

Fixing URL encoded entities in URL

I have tried to use AMP but for some reason URLs appear differently in Google search results, I.e. :
Original URL:
https://www.translatum.gr/forum/index.php?action=amp;topic=987010

URL in Search:
https://www.translatum.gr/forum/index.php?action=amp%3Btopic%3D985701
https://github.com/ampproject/amphtml/issues/31063

I was advised to "update the server to handle escaped query parameters" or "use & instead of ; for different query parameters". Could it be possible to fix this via htaccess? I.e.:

Find
forum/index.php?action=amp%3Btopic%3[ANY_TOPIC_ID_HERE]
Replace
forum/index.php?action=amp;topic=[ANY_TOPIC_ID_HERE]

This is what I have in htaccess now

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteCond %{HTTP_HOST} ^(.*)$  [NC]
    RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L]
</IfModule>


And this is the code I can see in search results (not sure which exactly of the URLs there is the one used to direct to the site, I can see data-amp and data-amp-cur values being different):

<a class="C8nzq BmP5tf amp_r" data-amp="https://www.translatum.gr/forum/index.php?action=amp;topic%3D985701" data-amp-cur="https://www.translatum.gr/forum/index.php?action=amp;topic=985701" data-amp-title="translatum.gr" data-amp-vgi="8458557019360116853" href="https://www.translatum.gr/forum/index.php?action=amp;topic=985701" data-ved="2ahUKEwim8cXvrvvsAhXCMewKHYUJDfEQFjAAegQIARAB" ping="/url?sa=i&amp;source=web&amp;rct=j&amp;url=https://www.translatum.gr/forum/index.php%3Faction%3Damp%3Btopic%3D985701&amp;ved=2ahUKEwim8cXvrvvsAhXCMewKHYUJDfEQFjAAegQIARAB&amp;psig=AOvVaw3Zumwox_YowxhDDwIehV-e&amp;ust=1605214160452451&amp;ampcf=1"><div class="abuKkc IhfN8d MUxGbd lyLwlc aLF0Z"><img class="eqA2re" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAAAMklEQVR4AWMY5OD/TIb/aZgIl+o0XAinanSdBAGFGmbS0gZMLxGrgSirCAQrYT2DHwAAv0tHhsJpXPsAAAAASUVORK5CYII=" alt="Image" aria-hidden="true" data-atf="1" width="16" height="16"><span class="Zu0yb UGIkD qzEoUe">www.translatum.gr<span class="kbNtnf Jzkcjd"> %u203A forum</span></span><span jsname="zYLzN" class="ZseVEf QzoJOb" aria-label="AMP logo"></span></div><h2 class="Uo8X3b">Web results</h2><div class="PpBGzd YcUVQe MUxGbd v0nnCb" aria-level="3" role="heading"><div class="V7Sr0 p5AXld PpBGzd YcUVQe">pre-owned -&gt; %u03BC%u03B5%u03C4%u03B1%u03C7%u03B5%u03B9%u03C1%u03B9%u03C3%u03BC%u03AD%u03BD%u03BF%u03C2, %u03B4%u03B5%u03CD%u03C4%u03B5%u03C1%u03BF %u03C7%u03AD%u03C1%u03B9, %u03C0%u03BF%u03C5 %u03B5%u03AF%u03C7%u03B5 %u03C0%u03C1%u03BF%u03B7%u03B3%u03BF%u03CD%u03BC%u03B5%u03BD%u03BF %u03B9%u03B4%u03B9%u03BF%u03BA%u03C4%u03AE%u03C4%u03B7, %u03C0%u03C1%u03BF%u03CA%u03B4%u03B9%u03CC%u03BA%u03C4%u03B7%u03C4%u03BF%u03C2 - Translatum</div></div></a>

Kindred

does it work if you use ANY other phrase other than amp;?


Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

spiros


Antes

There are no issues with AMP (header) links as well... what Kindred asking is;

https://www.simplemachines.org/community/index.php?topic%3D574227.msg4073381#msg4073381 - yes if the "=" sign becomes "%3D" is any other link works, the answer is no- unfortunately.

Advertisement: