admin管理员组文章数量:1122846
I have my wordpress server set up using php, mysql, and apache on my raspberry pi. I also have a dynamic dns hostname and configured my router's port forwardiing settings.
When trying to access my server from outside of my local LAN, when I type in my dynamic dns host, (for example, my phone on 4G mobile network or at school), the site incorrectly redirects to the server's local IP address: 192.168.0.18 so the page fails to load up.
This is very weird because I also have owncloud set up on my pi and in the same condition I try to access mydynamicdnshost/owncloud, it doesn't redirect me to local IP and the page loads up successfully.
I know this is a really basic problem with wordpress configuration but I simply cannot fix it. So does anyone know that please answer my question. Many thanks!
I have my wordpress server set up using php, mysql, and apache on my raspberry pi. I also have a dynamic dns hostname and configured my router's port forwardiing settings.
When trying to access my server from outside of my local LAN, when I type in my dynamic dns host, (for example, my phone on 4G mobile network or at school), the site incorrectly redirects to the server's local IP address: 192.168.0.18 so the page fails to load up.
This is very weird because I also have owncloud set up on my pi and in the same condition I try to access mydynamicdnshost/owncloud, it doesn't redirect me to local IP and the page loads up successfully.
I know this is a really basic problem with wordpress configuration but I simply cannot fix it. So does anyone know that please answer my question. Many thanks!
Share Improve this question edited Apr 9, 2017 at 11:11 cjbj 15k16 gold badges42 silver badges89 bronze badges asked Apr 9, 2017 at 10:38 TupopoTupopo 331 gold badge1 silver badge3 bronze badges3 Answers
Reset to default 1Change the Site URL in Options Table.
UPDATE `wp_options` SET `option_value` = 'YOUR_SITE_URL' WHERE `option_name` = 'siteurl' OR `option_name` = 'home';
Also change the static URLs in your post content.
UPDATE `wp_posts` SET `post_content` = REPLACE(post_content, '192.168.0.18/YOUR_LOCAL_SITE_URL/', 'YOUR_SITE_URL/');
Don't forget to change the table prefix if its not 'wp_'.
Edit : Access PHPMyAdmin of your server. Contact your Hosting Provider if you are not aware of this.
Select your WordPress Database & Access wp_options table. And change 'siteurl' && 'home' attribute values to your Live Website URL.
Hire a developer if you are not sure what you are doing !
Inspired @jitendra-rana answer, the direction was correct, but not full.
- Do dump of your database to the file.
- Open dump file and replace all
http://192.168.0.18
tohttp://your_site
- Execute dump file to replace all data in database.
- Clear cache (hard reload) of your site.
Profit.
In general, changing the WP_SITEURL and WP_HOME records in the wp_option table is not enough to make the entire website available. You need to change all the links, including image links, JS and CSS link, A tags, and in general, any link that goes out in html.
I have created a plugin and placed it in the WordPress repository, which publishes a website created on a local web server like Xampp/Wampp to the network. By setting your own Local IP in the plugin settings, your WordPress will be published in general on the network.
https://wordpress.org/plugins/local-to-ip/
本文标签: serverWordPress incorrectly redirects to local IP address
版权声明:本文标题:server - WordPress incorrectly redirects to local IP address? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736309115a1933902.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论