• Greetings,

    I host several WP sites on my server, and each one will not suppress index.php in the URL. If I attempt to navigate to a page without it, I get a 404 error.

    The .htaccess file normally contains this (default):

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

    I have tried setting the permalinks to /%postname%/ with the following in .htaccess, based on doing some searching.

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

    However, this still results in 404 errors. It is as if the .htaccess file is being ignored.

    Also, .htaccess does not get updated following any permalink changes from within WP. I am not sure whether it should be updating. The permissions are 644 and is owned by the account username.

    Thank you,

    Michael Reynolds

    • This topic was modified 8 years, 4 months ago by bdbrown.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Is that the entire contents of the .htaccess file? If there is something else after that, those rules will supersede the earlier ones.

    The permissions are 644 and is owned by the account username.The permissions are 644 and is owned by the account username.

    The file should be owned by the same owner that is running Apache.

    • This reply was modified 8 years, 4 months ago by kjodle. Reason: typofix
    Thread Starter Urantian

    (@urantian)

    Below is the entire .htaccess file contents. The server uses cPanel.

    Michael Reynolds

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    
    </IfModule>
    
    # END WordPress
    # php -- BEGIN cPanel-generated handler, do not edit
    # Set the “ea-php56” package as the default “PHP” programming language.
    <IfModule mime_module>
      AddType application/x-httpd-php .php .php5 .phtml
    </IfModule>
    # php -- END cPanel-generated handler, do not edit
    
    # BEGIN cPanel-generated php ini directives, do not edit
    # Manual editing of this file may result in unexpected behavior.
    # To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
    # For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
    <IfModule php5_module>
       php_flag asp_tags Off
       php_flag display_errors Off
       php_value max_execution_time 30
       php_value max_input_time 60
       php_value max_input_vars 1000
       php_value memory_limit 128M
       php_value post_max_size 8M
       php_value session.gc_maxlifetime 1440
       php_value session.save_path "/var/cpanel/php/sessions/ea-php56"
       php_value upload_max_filesize 2M
       php_flag zlib.output_compression Off
    </IfModule>
    # END cPanel-generated php ini directives, do not edit

    [Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]

    • This reply was modified 8 years, 4 months ago by bdbrown.
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Cannot Remove index.php from URL’ is closed to new replies.