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

I recently installed wordpress, I am having problems trying to change the permalink format,

when I change the default permalink to day and time

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

the created link does not work, 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 the default, this works fine.

I found some solutions that

 sudo a2enmod rewrite Module rewrite already enabled 

Another solution is to change the permissions of the .htaccess mode to 666 (granting permission to write the .htaccess file to wordpress) before changing the default permalink 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 is included by wordpress itself

Both solutions do not seem to work, is there anything else to change permalink settings?

+6
source share
3 answers

If this is a new web server installation, it is possible that .htaccess rules are not allowed by default. To fix this, edit the httpd.conf file (usually located in / etc / apache 2), find

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

and change

 AllowOverride None 

to

 AllowOverride All 

Then restart the web server and try again.

+18
source

Reset the desired permalink from the wordpress admin area and add this code to 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 out the posts and blog pages.

Thanks,

+1
source

You get this error because your web server cannot find the file and it does not send the request to Wordpress.

You need to add rewrite rules for your Wordpress, and the instructions for this depend on your web server software (Apache, nginx, etc.).

Example with nginx:

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

Which literally means: first try opening "/ 2015/03/16 / post-5-problem /" in the file system, if it does not exist, try adding a slash if this does not help pass the request to index.php (which is the main Wordpress file) with arguments.

Enabling the rewrite module is not enough; you need to add a rewrite rule.

0
source

Source: https://habr.com/ru/post/983858/


All Articles