404 not found , the requested URL <<url name>> not found on this server in wordpress

I recently installed wordpress , I am facing issues when I try to change the permalinks format ,

when I change the permalink from default to day and time

Read More
 Default    http://127.0.0.1/?p=123
 Day and name   http://127.0.0.1/2015/03/16/sample-post/ 

the link generated does’t working , it gives the same error 404 all the
time ,

 The requested URL /2015/03/16/post-5-problem/ was not found on this server.

But when the permalink type was default this works perfectly.

I found some solutions which are

sudo a2enmod rewrite

Module rewrite already enabled

Another solution is to change the mode permissions of .htaccess file to 666(giving write permission to wordpress of .htaccess file) before change the permalink from default to some other type ,

sudo chmod 666 /address_of_.htaccess 

i checked the .htaccess file

# 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

but the above seems to be correct , the above included by the wordpress itself

Both the solutions does’t seem to work , is there any other thing do I have to change to enable the permalink options ?

Related posts

Leave a Reply

4 comments

  1. If it is a fresh install of web server it is possible that .htaccess rules are not allowed by default. To fix that, edit you httpd.conf (usually it is in /etc/apache2), find

    <Directory "path/to/your/document/root">    
        # ....
    
         AllowOverride None
    
        # ....
    
    </Directory>
    

    and change

    AllowOverride None
    

    to

    AllowOverride All
    

    Then restart your web server and try again.

  2. Reset your desired permalink from wordpress admin area and add this code in htaccess:

    # BEGIN WordPress
    
    <IfModule mod_rewrite.c>
    ErrorDocument 404 /index.php?error=404
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    

    Now, check with blog posts and pages.

    Thanks,

  3. You are receiving this error because your webserver cannot find the file, and it’s not passing the request to WordPress.

    You need to add rewrite rules for your WordPress, and instructions for that depend on your webserver software (Apache, nginx, etc).

    Example with nginx:

    location / {
           try_files $uri $uri/ /index.php?$args;
    }
    

    Which literally means: try to open “/2015/03/16/post-5-problem/” in filesystem first, if it doesn’t exist try to add a slash, if that doesn’t help pass the request to index.php (which is WordPress main file) with the arguments.

    Enabling rewrite module is not enough, you have to add rewrite rule(s).