The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
PHP-General - Wordpress PHP Question
Discuss Wordpress PHP Question in the PHP Development forum on Dev Shed. Wordpress PHP Question PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

February 19th, 2013, 11:04 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 2
Time spent in forums: 30 m 40 sec
Reputation Power: 0
|
|
|
PHP-General - Wordpress PHP Question
I am hosting a Wordpress site locally on a webserver that is running Windows Server 2008 on my LAN. The wordpress website needs to be able to be accessed externally using a domain name (ww.somedomain.co) and also internally either using its local server IP address or the domain name. Currently using wordpress it needs to be either or.
My question is, is there a PHP code that I can use to check to see if the HTTP request to access the website is external or internal? If the request is external, use a certain IP or domain name and if the request is coming from an internal host, use a different IP address.
I know this is not a clear question. Ask away if you don't understand what i'm asking.
|

February 19th, 2013, 12:24 PM
|
 |
Still alive
|
|
Join Date: Mar 2007
Location: Washington, USA
|
|
|
You can use $_SERVER["HTTP_HOST"] to get the domain name that the site is being accessed as.
|

February 19th, 2013, 06:21 PM
|
 |
Lost in code
|
|
|
|
|
Without a lot of hacking the code it is very difficult to get a WordPress installation to work at more than one host name because the core code is completely written assuming that it will only ever operate at a single host name. The problem goes far beyond just the code, because WordPress also stores full URLs, including the host name, in many places in the database. Even moving WordPress permanently from one host name to another is difficult.
Your best bet would be to create a hosts file entry locally that maps the external domain to the internal IP of the web server hosting WordPress.
|

February 20th, 2013, 02:23 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 11
Time spent in forums: 2 h 53 m 30 sec
Reputation Power: 0
|
|
|
use rewrite rules
use rewrite rules, add it in .htaccess file and put that file in your wordpress folder.
|

February 20th, 2013, 06:56 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 2
Time spent in forums: 30 m 40 sec
Reputation Power: 0
|
|
|
Thanks for the replies. For the time being we just decided to turn on reverse NAT on our network to allow the request to travel back into the our LAN. It seems to be working fine now.
|

February 21st, 2013, 12:42 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 1
Time spent in forums: 25 m
Reputation Power: 0
|
|
|
Yes, you need to rewrite the rules and just add it to .htaccess file and place it in your root folder.
|

February 21st, 2013, 05:11 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Location: Bangalore, India
Posts: 1
Time spent in forums: 28 m 20 sec
Reputation Power: 0
|
|
|
$-SERVER["HTTP-HOST"] -use this to get the domain name.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|