Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted February 16, 20223 yr I am wondering why this simple mod rewrite to eliminate a duplicate home page is causing errors: # Remove index.php from root URL RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html) [NC] RewriteRule ^index\.php$ https://www.mysite.com/ [R=301,L] Quote The link could not be embedded because of an unexpected error: error: "The CSRF protection key did not match. This may indicate a plugin or theme is out of date. Please contact technical support for more information.".
February 16, 20223 yr This line is likely the problem: RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html) [NC] Try this instead (note I have not tested): RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html)$ [NC]
February 16, 20223 yr I am wondering why this simple mod rewrite to eliminate a duplicate home page is causing errors: # Remove index.php from root URL RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html) [NC] RewriteRule ^index\.php$ https://www.mysite.com/ [R=301,L] Try this #Remove index.php|html at the end of the URL and change to / RewriteCond %{THE_REQUEST} ^GET\ /.*/index\.(php|html)\ HTTP RewriteRule (.*)index\.(php|html)$ /$1 [R=301,L]
February 16, 20223 yr Author I spoke to soon, and edited my response...for some reason it isn't redirecting, and stays on the /index.php Edited February 16, 20223 yr by sadams101
February 17, 20223 yr Author In the end it may not matter, as I do know that there is a canonical link to my base URL from the /index.php version, however, to be SEO technically correct there really should be a 301 redirect as well. So far I've not found a way to make this work that doesn't create issues.