HTTP 404 with a fixed address

So, I just created the first page on this site. It works when I use the default persistent binding settings.

If I changed the permalink settings to use the Post name, then I get HTTP 404.

I'm not sure what happened, or I broke something. Can someone help me fix it?

The site is hosted on apache.

Page exists, link is broken

+6
source share
4 answers

Are you using XAMPP or MAMP? There are a couple of common hiccups with these environments taken from WordPress Codex: Troubleshooting Permanent Link Issues

XAMPP users (Windows) . Some versions of XAMPP do not allow mod_rewrite by default (although it is compiled in Apache). To enable it - and thus allowing WordPress to write the .htaccess file needed to create fairly permalinks - you need to open apache / conf / httpd.conf and uncomment the line LoadModule rewrite_module modules / mod_rewrite.so (i.e. remove the character hash / pound in front of the line).

WAMP users (Windows) . Some versions of WAMP (all versions?) Do not enable mod_rewrite or allow the use of SymLinks by default. To enable the required functionality go to the apache / conf / httpd.conf file, open it with a text editor and uncomment the line LoadModule modules rewrite_module / mod_rewrite.so (i.e. remove the hash / pound sign in front of the line). Then further in the same file there is a section that begins with the line “FollowSymlinks Options”. Change the second line in this section from "AllowOverride none" to AllowOverride all. Save the edited httpd.conf file and restart all WAMP modules. Your permalinks should now work.

You can also see Permalinks without mod_rewrite if your sandbox does not have mod_rewrite .

Apache

If you use Apache, there are usually two other culprits for breaking permalinks: .htaccess not created (due to permission settings) or the Apache AllowOverride directive is not enabled.

Firstly, if you use SSH on your server, do you see the generated .htaccess file in the root? If not, WordPress may not have permission to write this file. It is also possible that the file exists , but this WordPress cannot edit it. In any case, you can chmod this file (and create it if it does not exist) up to 666.

Then make sure your Apache configurator has the following settings:

  <Directory /> Options FollowSymLinks AllowOverride All </Directory> 

Finally, read the “ Permanent Link Troubleshooting” section of WordPress Codex. There are several other tips and tricks on why permalinks may not work.

+10
source

found this post on another site that has helped many people already

I finally managed to solve the problem! Solution: I used a custom constant link structure http://kyl.fi/%category%/%postname%/ . I removed the trailing slash (i.e., the Last /) and the veil. However, I am pretty sure that I used the permalink structure with a trailing slash before without any problems, so I am still confused and would be interested to know more about this issue if anyone has an explanation.

All standard permalinks have trailing / there.

+1
source

In my case, I am using the NGINX web browser with the installation of WordPress. The fix is ​​to add the following code to the NGINX directives:

location / { try_files $uri $uri/ /index.php?$args; } # Add trailing slash to */wp-admin requests. rewrite /wp-admin$ $scheme://$host$uri/ permanent; location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ { expires max; log_not_found off; }

If you use the excellent (open source) ISPconfig.org CPanel substitute, go to the Sites page on the Options tab, enter the code snippet above for the NGINX directives. ISPconfig has the function of adding common code snippets for quick access on the Options tab.

After completing the above fix, I was able to use any of the Permalinks options in WordPress.

0
source

In my case, firstly, I had to update the .htaccess file inside the website root folder:

 # 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 

WordPress does this automatically if it has write permission. Otherwise, he will complain that he cannot write to him and give the above code example so you can manually update .htaccess .

After that I edited the apache2.conf file. On Linux, it is located in /etc/apache2/apache2.conf , there will be such a section:

 <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> 

Change AllowOverride None to AllowOverride FileInfo .

Finally, run the following commands:

 sudo a2enmod rewrite service apache2 restart 

All these steps are necessary for work.

0
source

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


All Articles