The following tutorial column of WordPress will introduce to you about simultaneous access inside and outside the WordPress LAN. I hope it will be helpful to friends in need!
My configuration environment:
The server is set up on a computer at home, fixed LAN IP: 192.168.1.100, using the telecommunications network, there is a public IP, but 80 The port cannot be used and has its own domain name: www.xxx.cn
Use the peanut shell dynamic domain name to update the IP to your own domain name. nginx configures the virtual host LAN external port 23456, the LAN internal port 80, and the homepage directory is the same.
WordPress is placed in the wordpress folder in the root directory of the website. In the setting interface, both siteurl and home are set to http://www.xxx.cn:23456/wordpress
. There is no problem when accessing from the external network. However, it is not possible to access http://www.xxx.cn:23456/wordpress from the internal network. Even if you open it, you can't access 192.168.1.100/wordpress.
According to the online method, modify the siteurl and home in the database to /wordpress. Access outside the LAN is not normal (some pages can be opened, such as the administrator interface, but the homepage cannot be opened).
My solution:
Keep the settings in the data http://www.xxx.cn:23456/wordpress unchanged. Follow the instructions below to modify the get_option function in wordpress\wp-includes\option.php.
This is just an idea and can be modified according to specific circumstances. For example, if you don't use a special port, you can directly write lines 4, 5, and 6 as line 5.
function get_option( $option, $default = false ) { //自己写一个get_option函数 $my_option=my_get_option($option,$default); //调用原来的函数 if($option=="siteurl" || $option == "home"){ //针对siteurl和home做修改,其他不变 if($_SERVER['HTTP_HOST']!="www.xxx.cn"){ //如果不是用域名访问的 $my_option="http://".$_SERVER['HTTP_HOST']."/wordpress"; //就跳转到当前URL里的服务器地址,比如本地的localhost或局域网访问的192.168.1.100 } } return $my_option; } function my_get_option( $option, $default = false ) { //将原来的get_option函数名称改成my_get_option
The above is the detailed content of About simultaneous access inside and outside WordPress LAN. For more information, please follow other related articles on the PHP Chinese website!

WordPressisuser-friendlyduetoitsintuitiveinterfaceandCMS,whichseparatescontentfromdesign.Itoffersarichtexteditorforeasycontentcreationandamedialibraryfororganization.Itsflexibilityisenhancedbynumerousthemesandplugins,thoughoverusecanimpactperformance

WordPressissuitableforbusinesssettings.1)Itsupportse-commercewithpluginslikeWooCommerce,allowingproductmanagementandpaymentprocessing.2)ItservesasaCMSforcorporateblogs,enhancingSEOandengagement.3)Customizationispossiblewithnumerousthemesandplugins.4)

WordPressisnotidealforhigh-trafficwebsites,customandcomplexapplications,security-sensitiveapplications,real-timedataprocessing,andhighlycustomizeduserinterfaces.Forhigh-trafficsites,useNext.jsorcustomsolutions;forcomplexapplications,optforDjangoorRub

Yes,youcanbuildablogwithWordPress.1)ChoosebetweenWordPress.comforbeginnersorWordPress.orgformorecontrol.2)Selectathemetopersonalizeyourblog'slook.3)Usepluginstoenhancefunctionality,likeSEOandsocialmediaintegration.4)Customizeyourthemewithsimplecodetw

WordPresscanbesecureifmanagedproperly.1)KeeptheWordPresscoreupdatedtopatchvulnerabilities.2)Vetandupdatepluginsandthemesfromreputablesources.3)Enforcestrongpasswordsandusetwo-factorauthentication.4)Chooseahostingproviderwithgoodsecuritypractices.5)Ed

WordPresscanbuildvarioustypesofwebsites:1)Personalblogs,easytosetupwiththemesandplugins.2)Businesswebsites,usingdrag-and-dropbuilders.3)E-commerceplatforms,withWooCommerceforseamlessintegration.4)Communitysites,usingBuddyPressorbbPress.5)Educationalp

WordPressisapowerfulCMSwithsignificantadvantagesandchallenges.1)It'suser-friendlyandcustomizable,idealforbeginners.2)Itsflexibilitycanleadtositebloatandsecurityissuesifnotmanagedproperly.3)Regularupdatesandperformanceoptimizationsarenecessarytomainta

WordPressexcelsineaseofuseandadaptability,makingitidealforbeginnersandsmalltomedium-sizedbusinesses.1)EaseofUse:WordPressisuser-friendly.2)Security:Drupalleadswithstrongsecurityfeatures.3)Performance:GhostoffersexcellentperformanceduetoNode.js.4)Scal


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version
SublimeText3 Linux latest version

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver Mac version
Visual web development tools
