• Permalinks work fine if the URL is correct.

    For example, this type of URL works fine:
    https://www.dogcollarsboutique.com/dog-collars-blog/dog-lifestyle/ten-tips-for-going-green-with-your-dog/

    However, sometimes I find 404 errors with this type of URL (index.php added to end).
    https://www.dogcollarsboutique.com/dog-collars-blog/dog-lifestyle/ten-tips-for-going-green-with-your-dog/index.php

    I don’t know where these are being generated, but I see them this way in Google Analytics as a visited page. I think they may be added by search engines, but I don’t know and think it may be pointless to try to stop them.

    Rather I would like to accept a permalink URL of the directory style format when index.php is appended to it and go to the correct page with without generating a 404.

    Does anyone know how to do this?

    Site Info:

    I have permalinks turned on with this structure:
    /%category%/%postname%/

    This is my .htaccess
    —————–
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /dog-collars-blog/
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /dog-collars-blog/index.php [L]
    ——————-

    Thanks,
    Scott

Viewing 2 replies - 1 through 2 (of 2 total)
  • For .htaccess content, see if you have the following at the end

    </IfModule>

    If yes, then .htaccess looks perfectly fine. Maybe there is conflict with your site root’s .htaccess if there is any (above the /dog-collars-blog/).

    Thread Starter sforler

    (@sforler)

    Yes, I do have </IfModule> at the end in .htaccess, I didn’t copy it out properly.

    Here is the beginning portion of the root .htaccess (the rest is redirects of old pages and parked redirects of domains). Any direction would be greatly appreciated.

    RewriteEngine on
    
    DirectoryIndex home.php index.php index.html
    
    # 301 Rewrite
    rewritecond %{http_host} ^dogcollarsboutique.com [nc]
    rewriterule ^(.*)$ https://www.dogcollarsboutique.com/$1 [r=301,nc]
    
    #SEO Friendly URLs
    Options +SymlinksIfOwnerMatch -Indexes
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /
    RewriteRule ^(.*)-p-([0-9]*)-c-([0-9]*)-sort-(.*)-sdir-([0-9]*).html$ home.php?cat=$3&page=$2&sort=$4&sort_direction=$5 [L]
    RewriteRule ^(.*)-p-([0-9]*)-c-([0-9]*).html$ home.php?cat=$3&page=$2 [L]
    RewriteRule ^(.*)-c-([0-9]*).html$ home.php?cat=$2 [L]
    RewriteRule ^(.*)-mid-([0-9]*)-p-([0-9]*)-sort-(.*)-sdir-([0-9]*).html$ manufacturers.php?manufacturerid=$2&page=$3&sort=$4&sort_direction=$5 [L]
    RewriteRule ^(.*)-mid-([0-9]*)-p-([0-9]*).html$ manufacturers.php?manufacturerid=$2&page=$3 [L]
    RewriteRule ^(.*)-mid-([0-9]*).html$ manufacturers.php?manufacturerid=$2 [L]
    RewriteRule ^(.*)-p-([0-9]*).html$ product.php?productid=$2&$3 [L]
    RewriteRule ^(.*)-sp-([0-9]*).html$ pages.php?pageid=$2 [L]
    RewriteRule ^(.*)-p-([0-9]*).html&xid=(.*)$ product.php?productid=$2&xid=$3 [L]
    RewriteRule ^(.*)-c-([0-9]*).html&xid=(.*)$ home.php?cat=$2&xid=$3 [L]
    RewriteRule ^(.*)-mid-([0-9]*).html&xid=(.*)$ manufacturers.php?manufacturerid=$2&xid=$3 [L]
    RewriteRule ^(.*)-sp-([0-9]*).html&xid=(.*)$ pages.php?pageid=$2&xid=$3
    RewriteRule ^contact.html$ help.php?section=contactus&mode=update [L]
    RewriteCond %{HTTP_HOST} ^dogcollarsboutique.com
    RewriteRule (.*) https://www.dogcollarsboutique.com/$1 [R=301,L]
    </IfModule>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘404 pages when index.php appended to the URL of a directory style permalinks URL’ is closed to new replies.