Jump to content

Recommended Posts

Posted

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.".


 

Posted

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]

 

Posted
33 minutes ago, sadams101 said:

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]

 

Posted

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...