Remove index.php from WordPress Permalinks
Sometimes it can happens when you install WordPress with the default permalink structure everything will work fine. But when you want to change the permalink to /%year%/%monthnum%/%postname%/ it creates the following url index.php/%year%/%monthnum%/%postname%/ (mind the index.php).
The reason of this problem is that WordPress doesn’t think it’s running on Apache so it doesn’t create/write to the .htaccess file. It looks at the $_SERVER['SERVER_SOFTWARE'] variable which comes back with “WebServerX” based on what phpinfo() says on your server.
So, if you edit the /wp-includes/vars.php file and change the server detection area to:
// Server detection // $is_apache = ((strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) || (strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false)) ? true : false; $is_apache = 1; $is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false) ? true : false;
It should work. Basically just bypassing the variable check and manually telling it that it’s running on Apache will remove the index.php from the url.