admin管理员组

文章数量:1332404

Permalink to products and post of my website getting 404 error. after saving the permalink type in Setting -> Permalink page they will work correctly. But if I refresh the links they get 404 error again. Actually the links work only once.

this is my .htaccess file:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^.*-(\d+)/$ securityl/index\.php?id=$1&%{QUERY_STRING} [L]
RewriteRule ^.*-y(\d+)/$ securityl/index\.php?cat=$1&%{QUERY_STRING} [L]
RewriteRule ^.*(website[a-z]+map\.xml)$  websiteguide/$1 [L]

RewriteBase /
</IfModule>

I have changed the theme to store front and it's not working.

Permalink to products and post of my website getting 404 error. after saving the permalink type in Setting -> Permalink page they will work correctly. But if I refresh the links they get 404 error again. Actually the links work only once.

this is my .htaccess file:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^.*-(\d+)/$ securityl/index\.php?id=$1&%{QUERY_STRING} [L]
RewriteRule ^.*-y(\d+)/$ securityl/index\.php?cat=$1&%{QUERY_STRING} [L]
RewriteRule ^.*(website[a-z]+map\.xml)$  websiteguide/$1 [L]

RewriteBase /
</IfModule>

I have changed the theme to store front and it's not working.

Share Improve this question asked Jul 6, 2020 at 19:42 ErfanErfan 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

I realized that some php code changes the content of .htaccess file. The php folder was in a directory named 'securityl'. I've been removed that directory but whenever the website was refreshing the directory and also the php files inside it was recreating. In the end I discovered that some code in wp-include/load.php is creating the directory and I re-downloaded the wordpress and replaced the clean wp-include, then the problem solved and there was no code for creating securityl folder! . I don't know how and why the contents of that files were changed.

本文标签: permalinksWoocommerce posts and products links works only once and then get 404 error