Wordpress erasing .htaccess - gets stuck in redire

2019-09-03 15:43发布

I installed Wordpress to the root of my site using Scriptaculous and found I was unable to access it due to a redirect loop. My address bar would look like http://site.com/site.com/site.com...

I found that there was no .htaccess file for this site so created one by copying it from another WP install:

# 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

This made my site work. However I've found that some actions in the dashboard totally erase the htaccess file so it looks like this:

# BEGIN WordPress

# END WordPress

Changing permalinks did this and it seems that sometimes when trying to edit a page it does it too. When the .htaccess file looks like this the site gets stuck in a loop again until I copy back the old info. Any suggestions for me?

2条回答
\"骚年 ilove
2楼-- · 2019-09-03 16:21

It sounds like a plugin or your theme is messing around with the rewrite rules and the htaccess file.

Disable the cache if any (there's a define in your wp-config.php file if you're using one), all plugins and revert to one of the built-in themes, then reenable things one by one until you spot the one that is breaking things (your caching plugin is a good place to start).

If you can't access the admin area because of the same issue, temporarily rename the plugins folder to e.g. plugins-disabled to reset the active plugins.

查看更多
趁早两清
3楼-- · 2019-09-03 16:33

Are you using some cache plugin ? If so then check if it's recently updated because i also faced same issue and i was using w3 Total cache - On my side problem occured because of updating w3 total cache but just emptied cache and re-activated, reconfigured it.

Moreover, you need to check if your Theme or some other Plugin is causing this problem i.e. changing rewrite rules.

Try what Denis said & i hope that will help as well.

查看更多
登录 后发表回答