Support » Fixing WordPress » Why is index.php being redirected?

  • rubiconcsl


    Hi all. Silly question time I think. Be gentle!

    I have had a phpBB site running for about 15 years and now want to wrap it in a WP site. The WP w3all phpBB plugin looks ideal. I don’t want to migrate the phpBB install, because a) I quite like phpBB as a forum and b) after 15 years, it’s got some pretty good search engine placement.

    The phpBB site was and is installed in a /forum sub-directory. I want to leave it there (as already mentioned) for search engine reasons. I think it also makes sense to keep it separate.

    I have always had an apache redirect in place, such that anyone going to the main domain, always gets moved to the /forum directory and all is well in the world. I did this, as even way back then, I had an inkling that I would expand it to a fuller site.

    I have now installed WP in the root. So I now have WP in /public_html and phpBB in /public_html/forum. All good so far.

    Whilst I develop the WP site (which may take me some time), I want people to continue to just get moved to the /forum directory and just see the phpBB forum – and have no idea that the WP site even exists.

    The following seems to work fine:-

    # php -- END cPanel-generated handler, do not edit
    RewriteCond %{HTTP_HOST} ^thepompeychimes\.net$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.thepompeychimes\.net$
    RewriteRule ^/?$ "https\:\/\/thepompeychimes\.net\/forum" [R=301,L]

    That should only redirect the URIs: and (with or without the trailing ‘/’.

    If I enter, it correctly does NOT redirect. However, the WP file DOES redirect. I don’t think it is the RewriteRule, otherwise, both URLs would redirect. Is WP somehow causing this? In WP General settings, I can see both WordPress Address and Site Address are set to Is WP causing this, such that when I enter, it does actually execute index.php, but a set of steps subsequently redirect to due to the Site Address setting, which then gets redirected by the .htaccess RewriteRule?

    Any help is appreciated. I can get to other pages, such as the login page and I can display the sample page installed with WP. But the home page (index.php) always gets redirected to the phpBB forum.

Viewing 2 replies - 1 through 2 (of 2 total)
  • This has nothing to do with WordPress per se.

    When you access a directory, it is the index file inside that directory (if any exists) that gets opened. If no index file exists, the content of the directory is listed (if directory indexing is enabled) or a 403 error message is shown (if directory indexing is disabled on the server).

    So implies

    And the redirection you’re seeing is normal, it’s the expected behaviour (from the technical point of view), even though it may not be the desired behaviour.

    Thread Starter rubiconcsl


    @gappiah – thanks for the reply.

    The problem I have though is that index.php shouldn’t redirect. The only URIs that should redirect are either a single / or nothing (as per the apache RewriteRule. It searches for ^/?$ which means just a front slash, which is optional.

    # php -- END cPanel-generated handler, do not edit
    RewriteCond %{HTTP_HOST} ^thepompeychimes\.net$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.thepompeychimes\.net$
    RewriteRule ^/?$ "https\:\/\/thepompeychimes\.net\/forum" [R=301,L]

    Before I installed WP, I had an index.php file and that didn’t redirect. I renamed that file index_pre_wordpress.php before I installed WP. That still doesn’t redirect. All the other files in the directory do not redirect. It’s just the newly created WP index.php that does. That’s what makes me think it is something going on in the background, where WP is stripping the index.php bit, which then does get picked up by the RewriteRule.

    I have tested this just now. If I comment out the RewriteRule in .htaccess and enter, nothing redirects and I see the WP home page. If I then put the RewriteRule back, redirects to No other file redirects.

    I think I’ll have to look around and see if I can create a rewrite that does the following. I’m sure it must be possible and then it simply won’t redirect me. It won’t be too much hassle to update the .htaccess file if my ip address changes: –

    If ( 
          (host is OR
           host is
          (ip address isn't my ip address)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.