PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 19th, 2013, 11:04 AM
jmaty23 jmaty23 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 2 jmaty23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #2  
Old February 19th, 2013, 12:24 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,683 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 2 h 49 m 16 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
You can use $_SERVER["HTTP_HOST"] to get the domain name that the site is being accessed as.

Reply With Quote
  #3  
Old February 19th, 2013, 06:21 PM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Lost in code
Click here for more information.
 
Join Date: Dec 2004
Posts: 7,931 E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 2 Months 7 h 43 m 47 sec
Reputation Power: 6991
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.
__________________
PHP FAQ
How to program a basic, secure login system using PHP

Quote:
Originally Posted by Spad
Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

Reply With Quote
  #4  
Old February 20th, 2013, 02:23 AM
devsou65 devsou65 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 11 devsou65 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #5  
Old February 20th, 2013, 06:56 AM
jmaty23 jmaty23 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 2 jmaty23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #6  
Old February 21st, 2013, 12:42 AM
Neuronimbus Neuronimbus is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 1 Neuronimbus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #7  
Old February 21st, 2013, 05:11 AM
jainteq jainteq is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Location: Bangalore, India
Posts: 1 jainteq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m 20 sec
Reputation Power: 0
Send a message via Yahoo to jainteq
Facebook
$-SERVER["HTTP-HOST"] -use this to get the domain name.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP-General - Wordpress PHP Question

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap