Fishpig: Autologin not working authentication exception because of index.php

Fishpig: Autologin not working authentication exception because of index.php

August 9, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Fishpig: Autologin not working authentication exception because of index.php

Solving Fishpig WordPress Autologin Issues in Magento

The Problem: Fishpig AutoLogin Failing After Removing index.php

We recently received an intriguing question from one of our valued readers regarding the Fishpig WordPress integration and its autologin feature in a Magento environment.

The user had successfully installed Fishpig’s WordPress Integration for Magento CE 1.7.02 but encountered a peculiar issue after removing index.php from the frontend using rewrite rules. The Fishpig WordPress autologin functionality stopped working, throwing an authentication exception with the message “Unable to login.”

The error logs revealed an exception stemming from the Fishpig system helper:

exception 'Exception' with message 'WordPress Auto Login Failed: HTTP/1.1 401 Authorization Required...'

The root cause seemed to be a server response indicating unauthorized access.

The Initial Diagnosis

Fishpig support provided initial guidance, suggesting that the Magento installation needed to be configured without using index.php. However, removing index.php from the admin area and adjusting rewrite rules in the WordPress .htaccess file did not resolve the autologin issue entirely.

The problem persisted due to the presence of index.php in the autologin button’s URL. Removing it from the WordPress .htaccess only affected the admin URL, leaving the autologin link intact with the problematic index.php.

The Solution: Cleaning Up Rewrite Rules

To solve this predicament, we need to ensure that our rewrite rules are properly configured for both the Magento frontend and the Fishpig WordPress integration.

Let’s start by addressing the Magento frontend rewrite rules. The user had provided a snippet of their current rewrite configuration:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

This configuration is almost correct but lacks the necessary RewriteCond for Magento URLs. To fix this, we need to add the following condition:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# Remove index.php from URL
RewriteRule ^index\.php$ - [L]

# Handle Magento URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|wp-admin|wp-includes|wp-content|uploads)$
RewriteRule .* index.php [L]
</IfModule>

The added RewriteCond excludes specific directories like wp-admin, wp-includes, and wp-content, ensuring the rewrite rules do not interfere with the Fishpig WordPress integration.

Next, we need to address the WordPress .htaccess. The user had attempted to remove index.php from the admin URL but failed to account for the autologin link:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
RewriteRule ^/wp/index.php/(.*)$ /wp/$1 [L,R]
</IfModule>

To resolve this, we need to update the rewrite rule for the autologin link:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp/

# Remove index.php from admin URL and autologin link
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L,R]

# Adjust RewriteRule for autologin link
RewriteRule ^/wp/admin/wordpress/login/(.*)$ /wp/admin/$1 [L,R]
</IfModule>

By updating the rewrite rules in both Magento and WordPress, we can ensure that index.php is properly handled across all relevant URLs.

The Final Steps

After implementing these changes, make sure to clear your browser cache and test the autologin functionality again. If everything is configured correctly, you should no longer encounter the authentication exception.

Remember, it’s essential to have a thorough understanding of rewrite rules when working with Magento and its integrations. Proper configuration ensures optimal performance and minimizes potential issues like the one described in this post.

Conclusion

In summary, resolving the Fishpig WordPress autologin issue required a meticulous approach to rewrite rules for both Magento and the WordPress integration.

By addressing the Magento frontend rewrite rules, excluding specific directories from the conditions, and updating the WordPress .htaccess file to handle the autologin link correctly, we can successfully restore the functionality of the Fishpig WordPress auto-login feature without any authentication exceptions or performance degradation.

If you find yourself facing similar challenges while working with Magento integrations or have questions about other aspects of Magento development, feel free to explore our blog at https://laravelcompany.com for more insights and solutions from experienced developers.

Magento 1 Admin Configuration Errors

Our network