I have noticed some strange stuff regarding one of our websites. In ahrefs.tld, the "Broken Backlinks" shows some strange things.
[Moderator Note: The full contents of the .htaccess file was removed because it's not required here]
[Moderator Note: Removed link to third-party image hosting website. Please upload images directly to the thread as attachments]
I have checked the redirects, they all work as intended. In the sitemap there is no error whatsoever. The issue only occurs, as it seems, when an old backlink is crawled by ahref.tld's crawler. Same thing in Majestic.
Note: Yes, I need to use PHP5.6 because parts of the code are deprecated in newer versions.
A normal hyperlink's code to a non https version of a page looks good:
Now, according to the report, this is 301 redirected to it's https version (as it should). HOWEVER, /index.php/ is inserted into the URL:
which is, obviously, a 404 page.
Please notice the substitution of /maincategory/ with /index.php/
The corect 301 redirect result should be, of course:
So, the 301 redirect rules does work for redirecting http://www -> https://www. But why the /index.php/ is replacing the /maincategory/?
The 301 redirect rules from the top of the .htaccess file should redirect anything that is:
In the header I have these meta tags, if these could have any importance in that regard:
It's a bit of an issue because it affects the user experience, link juice is lost and, overall, annoys me like nothing else.
I know I am missing something, but I have no clue what.
On the live website I wasn't able to find any faulty redirect, but again, I have the SSL certificate installed for *example.tld.
So, I am guessing that it has something to do with redirecting http://www. to the https version... and probably it's missing from somewhere a backslash. /
or, more probably
there is a conflict between the DirectoryIndex directive in Apache (prioritise index.html) and cPanel-generated handler for PHP?
Reference: check out the image, versus this code from the .htaccess file:
Note: that the homepage is indeed an index.html file. But I have an index.php one as well which serves anything else besides the homepage.
And this is the puzzle: what could be the reason that /index.php/ path is included in the URL replacing /maincategory/.
Thank you for any suggestion!
Regards, Robert G.
- PHP/5.6.40
- Server Version: Apache/2.4.39 (cPanel) OpenSSL/1.0.2s mod_bwlimited/1.4
- PHP-FPM not enabled
- Cloudflare has no implication in this. Tested it with and without it.
[Moderator Note: The full contents of the .htaccess file was removed because it's not required here]
[Moderator Note: Removed link to third-party image hosting website. Please upload images directly to the thread as attachments]
I have checked the redirects, they all work as intended. In the sitemap there is no error whatsoever. The issue only occurs, as it seems, when an old backlink is crawled by ahref.tld's crawler. Same thing in Majestic.
Note: Yes, I need to use PHP5.6 because parts of the code are deprecated in newer versions.
A normal hyperlink's code to a non https version of a page looks good:
Code:
<a href="http://www.example.tld/maincategoryname/subcategory/page,1.html" class="anchor" target="_blank" rel="noopener noreferrer" title="Dofollow backlink">more helpful hints</a>
which is, obviously, a 404 page.
Please notice the substitution of /maincategory/ with /index.php/
The corect 301 redirect result should be, of course:
So, the 301 redirect rules does work for redirecting http://www -> https://www. But why the /index.php/ is replacing the /maincategory/?
The 301 redirect rules from the top of the .htaccess file should redirect anything that is:
- http://www.example.tld -> https://www.example.tld (this is the most important to keep, actually... the website always had the www, so there are only a couple of backlinks pointing to the non www. version)
- http://example.tld -> https://www.example.tld
- https://example.tld -> https://www.example.tld
In the header I have these meta tags, if these could have any importance in that regard:
Code:
<link rel="canonical" href="https://www.example.tld/" />
<meta name="MSSmartTagsPreventParsing" content="TRUE" />
<base href="https://www.example.tld/" />
On the live website I wasn't able to find any faulty redirect, but again, I have the SSL certificate installed for *example.tld.
So, I am guessing that it has something to do with redirecting http://www. to the https version... and probably it's missing from somewhere a backslash. /
or, more probably
there is a conflict between the DirectoryIndex directive in Apache (prioritise index.html) and cPanel-generated handler for PHP?
Reference: check out the image, versus this code from the .htaccess file:
Code:
# php -- BEGIN cPanel-generated handler, do not edit
<IfModule mime_module>
AddHandler application/x-httpd-ea-php56 .php .php5 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
And this is the puzzle: what could be the reason that /index.php/ path is included in the URL replacing /maincategory/.
Thank you for any suggestion!
Regards, Robert G.
Last edited by a moderator: