admin管理员组文章数量:1290951
I installed WordPress locally and created a theme, which worked fine. Now, as I wanted to deploy the site to a webserver via FTP, I got stuck by an 301 Redirect loop which makes it impossible to reach the site (except for the backend login).
I moved WordPress into a subdirectory because I don't want to override the current site. The following steps didn't work:
- Changing
siteurl
andhome
from thewp_options
table (tried both www and non-www) - Editing the
.htaccess
so the RewriteBase is correct. After this didn't work, I deleted it, still no success - Search and replace the database for entries which might have the old url (using this script)
- Deleting the
.htaccess
from the root directory (htdocs) - Renaming the subdirectory and changing all paths again
- Overwriting the
siteurl
andhome
via wp-config.php
None of this worked. I know that the host forces to redirect to www, but no matter which kind of url type I enter, still redirecting. Any ideas?
PS: If I upload a single index.html file to this directory, it works fine...
I installed WordPress locally and created a theme, which worked fine. Now, as I wanted to deploy the site to a webserver via FTP, I got stuck by an 301 Redirect loop which makes it impossible to reach the site (except for the backend login).
I moved WordPress into a subdirectory because I don't want to override the current site. The following steps didn't work:
- Changing
siteurl
andhome
from thewp_options
table (tried both www and non-www) - Editing the
.htaccess
so the RewriteBase is correct. After this didn't work, I deleted it, still no success - Search and replace the database for entries which might have the old url (using this script)
- Deleting the
.htaccess
from the root directory (htdocs) - Renaming the subdirectory and changing all paths again
- Overwriting the
siteurl
andhome
via wp-config.php
None of this worked. I know that the host forces to redirect to www, but no matter which kind of url type I enter, still redirecting. Any ideas?
PS: If I upload a single index.html file to this directory, it works fine...
Share Improve this question asked Jan 15, 2015 at 11:24 AndrewAndrew 111 silver badge2 bronze badges 2- Have you tried clearing your browser cache? – TheDeadMedic Commented Jan 15, 2015 at 11:53
- Yes I did. Didn't help. – Andrew Commented Jan 15, 2015 at 12:15
3 Answers
Reset to default 2As mentioned in my comment, ensure you test the following in a "clean" browser:
- Set
siteurl
&home
tohttp://www.example/wordpress-subdirectory
- Set
permalink_structure
to nothing - Set
active_plugins
to nothing - Ensure there are no
WP_SITEURL
orWP_HOME
constants defined in yourwp-config.php
- Remove all rewrite rules to do with WordPress from your
.htaccess
Not of all these steps are necessarily required, but I'm trying to cover all bases here.
Attempt to log in. If you hit a white screen of death, it's most likely that your active theme is calling plugin-dependent functions. Change stylesheet
and template
in wp_options
to twentyfifteen
(or any default theme, and ensure it exists in your themes
directory).
Test the frontend. All good? Go and activate each plugin again, one by one, testing the frontend each time.
Hit the problem again? Clear browser cache and reset active_plugins
, then install & activate Deploy Helper
Head over to Tools > Deploy Helper.
In the "Fix paths and URLs" section, set From
to http://localhost
(or whatever you were using during development) and To
to http://www.example/wordpress-subdirectory
. Leave server paths as they are.
Run Fix.
Activate the troublemaking plugin again and all should be well.
I found the issue: it is a strange server configuration. The port mapping is a bit odd, since the port 80 is mapped to a five-digit port on the other side. That's why WordPress redirected into a loop.
To fix this kind of issue enter the HTTP port number into your WordPress settings:
http://your-domain:80/directory
or https://your-domain:443/directory
Thanks TheDeadMedic for your help!
Thanks to wpbeginner:
Go to Settings » General, change your WordPress and Site Address. If you have your address with www prefix, then change it to non-www URL, and if you have it with non-www URL then add the www prefix.
Of course, this can be edited directly in the WP_SITEURL
and WP_HOME
entries in the database.
本文标签: Infinite Redirect Loop after moving to subdirectory
版权声明:本文标题:Infinite Redirect Loop after moving to subdirectory 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741510184a2382561.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论