Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
Rank Math for now doesn’t support redirections with query parameters. We are working on an update where it will work but for now, you will need to use another redirections plugin to redirect those URLs (or use .htaccess).
Looking forward to helping you. Thank you.
βββββββ
Hi Alberto,
sorry but i don’t know how to use .htaccess
Can you help me to configure it?
I need just to redirect all the URLs starting with
https://www.mangiareinliguria.it/foto_cartoline_antiche.php?PHPSESSID=….
to
https://www.mangiareinliguria.it/photostory/foto-cartoline-antiche
Thank you!
Hello,
This is the coed you can add to your htaccess at the end to redirect your shred URLs:
RewriteCond %{QUERY_STRING} (^|&)PHPSESSID\=($|&)
RewriteRule ^foto_cartoline_antiche\.php$ /photostory/foto-cartoline-antiche? [L,R=301]
For future purposes, you can use this tool: https://salt.agency/tools/bulk-redirect-generator/ to generate htaccess rewrite rules for your redirections.
Hope that helps. If you have any further question(s), please let us know. Thank you.
Hi Michael,
as you suggested I added in my htaccess file your code at the end, and upload via FTP:
# BEGIN WordPress
# Le direttive (linee) tra BEGIN WordPress
e END WordPress
sono
# generate dinamicamente, e dovrebbero essere modificate solo tramite i filtri di WordPress.
# Ogni modifica alle direttive tra questi marcatori verrΓ sovrascritta.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# Wordfence WAF
<Files “.user.ini”>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
# END Wordfence WAF
RewriteCond %{QUERY_STRING} (^|&)PHPSESSID\=($|&)
RewriteRule ^foto_cartoline_antiche\.php$ /photostory/foto-cartoline-antiche? [L,R=301]
But if you check a sample URL as the bottom the result didn’t changed:
https://www.mangiareinliguria.it/foto_cartoline_antiche.php?PHPSESSID=375da19abedeb7b357cb4d62da06542a&id=127
Pleae, let me know where I wrong…
sorry, i forgot to add in my previous post this:
maybe inserting (.*) after the end of
foto_cartoline_antiche.php
in order to redirect all the URLs with different number of PHPSESSID ???
Hello,
Did you try generating one with the tool link I shared?
Please test the following:
RewriteCond %{QUERY_STRING} (^|&)PHPSESSID\= *($|&)
RewriteCond %{QUERY_STRING} (^|&)id\= *($|&)
RewriteRule ^foto_cartoline_antiche\.php$ /photostory/foto-cartoline-antiche?&%{QUERY_STRING}
Hope that helps. If you have any further question(s), please let us know. Thank you.
I’m sorry Michael,
I tried your last script but it didn’t work. It also blocked all the graphics of the site so I had to remove it.
I’m frustrated not being able to just redirect all urls that start with
https://www.mangiareinliguria.it/foto_cartoline_antiche.php?PHPSESSID
example:
https://www.mangiareinliguria.it/foto_cartoline_antiche.php?PHPSESSID=375da19abedeb7b357cb4d62da06542a&id=127
to just one single URL
https://www.mangiareinliguria.it/photostory/foto-cartoline-antiche
I’m loosing lots of visits that continue to share these old url that give also a 403 error instead a 404 error that could show my 404 page but in this way I lose everyone.
Hoping you can find me a rights script to use in .htaccess or any other solution…
Thaank you!
Hello,
We are extremely sorry but you will need to get in touch with your web host about that.
We do not offer any support for .htaccess related queries because that falls beyond the scope of support we provide.
If using redirects with query strings is important to you, please disable the redirection in Rank Math and use any other redirection plugin for creating those type of redirects.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.