0

i have changed the wordpress custom structure permalink to /%post_id%/%postname%/ and get this error :

404 Not Found The requested URL /mysite/blog/1/hello-world/ was not found on this server.

  • wordpress version 3.1.7
  • site address: localhost/mysite/blog

i'v changed this function in misc.php and saw the error again!

function got_mod_rewrite() {
    //$got_rewrite = apache_mod_loaded('mod_rewrite', true); //old line with false negative;
    $got_rewrite = true;//force the response to true as we know mod_rewite is installed;
    return apply_filters('got_rewrite', $got_rewrite);
}
1
  • You should never change core files in WordPress. The line in misc.php that you commented out will return TRUE by default, which means that, for some reason, apache_mod_loaded() doesn't think that mod_rewrite is installed. Double-check your server config.
    – Pat J
    Sep 22 '14 at 22:31
1

Mehdi, it's common problem, as Apache server is not set by this way by default. Your problem can be solved with some very simple steps (simply quoting Samuel B):

If you want to use permalinks, you will need to make a change inside another file: apache > Conf and find the file httpd.conf. Open that in a text editor. Use the search facility in the editor to find "rewrite". The line you need looks like this:

#LoadModule rewrite_module modules/mod_rewrite.so

You need to take away the hash sign so it looks like this

LoadModule rewrite_module modules/mod_rewrite.so

Now just save the file.

Reference: WordPress Support - Answer by Samuel B

And a warning:

REMEMBER:
NEVER EVER EDIT A CORE WORDPRESS FILE, IT'LL SIMPLY MAKE YOUR WP BUGGY.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.