How to remove index.php from WordPress Permalink
- November 16, 2016
- Posted by: Sadman Sakib
- Category: WordPress Tutorial
No Comments
Now in this tutorial, i will share a tips for removing index.php from your WordPress permalink. I solved this problem for one of my buyer.
Why this problem happen – That looks like your problem – Checkout this line in wp-includes/vars.php
/** * Whether the server software is Apache or something else * @global bool $is_apache */ $is_apache = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false);
From above code if $is_apache returns false, it’ll automatically add ‘index.php’ to a permalink.
How to solve – For solving this problem, you will need to override this variable manually, either in a plugin or your theme function.php file. Just add below code in your function.php file.
global $is_apache; $is_apache = true;
This is my method. If you know another, tell us. We will also add it in this post.