Reputation: 93
so I am having this issue for a while now, and I cannot seem to find a fitting solution.
Whenever I enable %postname% permalinks, my static homepage https://example.com/xy
stops working and delivers 301 “site is not redirecting properly” errors, while any other posts or pages on the site redirect properly, example https://example.com/xy/about-us
works.
If I revert back to plain links, I have no issues.
Two things that I’ve noticed are, if I add “index.php” at the end of the homepage it will load again, example https://example.com/xy/index.php
.
%postname% permalinks also work if I set site url inside a wp-config.php like this
define( ‘WP_HOME’, ‘http://example.com/xy’ );
define( ‘WP_SITEURL’, ‘http://example.com/xy’ );
However I am required to keep site url path relative, so this is not a desired fix.
I’ve tried disabling all plugins and changing theme to default to no avail. I've enabled AllowOverride for my root directory. I have mod rewrite enabled in apache, my .htaccess is generated by WP and looks like this:
RewriteEngine On
RewriteBase /xy/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /xy/index.php [L]
</IfModule>
Upvotes: 4
Views: 323
Reputation: 93
So I worked around this issue by adding following into my functions.php
function disable_front_page_redirects($redirect_url) {
if( is_front_page() ) {
$redirect_url = false;
}
return $redirect_url;
}
add_filter( 'redirect_canonical', 'disable_front_page_redirects' );
Upvotes: 4