Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How can I make it so that my site has to be a domain name
Old 08-13-2007, 01:41 PM How can I make it so that my site has to be a domain name
goheadtry's Avatar
Webmaster Talker

Posts: 730
Name: John
Location: United States of America, California
Trades: 0
Okay I was wondering how I could make it so if this is typed into the address bar
http://209.123.147.87
it will automatically change the name to


http://www.technologyforever.com because I do not want my site viewable using the ip just the domain name

Microsoft has done this
when http://207.46.232.182
is typed in it redirects to the domain name
__________________
Free $1 gift card when you signup at
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Last edited by goheadtry; 08-13-2007 at 03:27 PM..
goheadtry is offline
Reply With Quote
View Public Profile Visit goheadtry's homepage!
 
 
Register now for full access!
Old 08-14-2007, 04:25 PM Re: How can I make it so that my site has to be a domain name
blackfalcon's Avatar
Skilled Talker

Latest Blog Post:
New Site: 10DollarBluRay.com
Posts: 62
Name: JuanJose H. Galvez
Trades: 0
Code:
 
if($_SERVER['HTTP_HOST'] == '209.123.147.87') {
 header("Location:http://www.technologyforever.com");
}
Make sure you have this code parsed before you send any output, otherwise you will encounter an error if you don't have output buffering enabled.
blackfalcon is offline
Reply With Quote
View Public Profile Visit blackfalcon's homepage!
 
Old 08-14-2007, 04:42 PM Re: How can I make it so that my site has to be a domain name
goheadtry's Avatar
Webmaster Talker

Posts: 730
Name: John
Location: United States of America, California
Trades: 0
Can you explain what to do? So I can do It I am confused about what you are talking about
__________________
Free $1 gift card when you signup at
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

goheadtry is offline
Reply With Quote
View Public Profile Visit goheadtry's homepage!
 
Old 08-14-2007, 11:44 PM Re: How can I make it so that my site has to be a domain name
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
This is more of a htaccess solution rather than a php solution.

Code:
RewriteEngine On
RedirectMatch ^/~(.*)$ http://www.technologyforever.com/$1
 
# 301 technologyforever.com to www.
RewriteCond %{http_host} ^technologyforever.com [NC]
RewriteRule ^(.*)$ http://www.technologyforever.com/$1 [R=301,L]
__________________

<mgraphic /> - I don't have a solution but I admire the problem.

Last edited by mgraphic; 08-14-2007 at 11:46 PM..
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 08-15-2007, 12:32 AM Re: How can I make it so that my site has to be a domain name
goheadtry's Avatar
Webmaster Talker

Posts: 730
Name: John
Location: United States of America, California
Trades: 0
And will that get rid of the viewing by using the IP also
__________________
Free $1 gift card when you signup at
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

goheadtry is offline
Reply With Quote
View Public Profile Visit goheadtry's homepage!
 
Old 08-15-2007, 10:57 AM Re: How can I make it so that my site has to be a domain name
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
Quote:
Originally Posted by goheadtry View Post
And will that get rid of the viewing by using the IP also
Hmmm, I thought it would but I guess not.

Code:
# 301 IP to domain
RewriteCond %{http_host} ^209.123.147.87 [NC]
RewriteRule ^(.*)$ http://www.technologyforever.com/$1 [R=301,L]
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 08-15-2007, 10:19 PM Re: How can I make it so that my site has to be a domain name
blackfalcon's Avatar
Skilled Talker

Latest Blog Post:
New Site: 10DollarBluRay.com
Posts: 62
Name: JuanJose H. Galvez
Trades: 0
Quote:
Originally Posted by goheadtry View Post
Can you explain what to do? So I can do It I am confused about what you are talking about
Just add those lines of code before anything else, I would do it in my application_top.php files a file which is included on every page before I do any other processing or ouput. If you have a file which is used like that just insert this code before anything else runs and you should be set.
blackfalcon is offline
Reply With Quote
View Public Profile Visit blackfalcon's homepage!
 
Old 08-15-2007, 10:23 PM Re: How can I make it so that my site has to be a domain name
goheadtry's Avatar
Webmaster Talker

Posts: 730
Name: John
Location: United States of America, California
Trades: 0
Quote:
Originally Posted by mgraphic View Post
Hmmm, I thought it would but I guess not.

Code:
# 301 IP to domain
RewriteCond %{http_host} ^209.123.147.87 [NC]
RewriteRule ^(.*)$ http://www.technologyforever.com/$1 [R=301,L]
A bit od at what id does to mod rewrite on urls

http://209.123.147.87/game1.html

click that and watch what happens to the file name on the url
__________________
Free $1 gift card when you signup at
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

goheadtry is offline
Reply With Quote
View Public Profile Visit goheadtry's homepage!
 
Old 08-16-2007, 04:52 AM Re: How can I make it so that my site has to be a domain name
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
are you on dedicated hosting?

because if you are not, you won't be able to.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-16-2007, 08:16 AM Re: How can I make it so that my site has to be a domain name
shivaji's Avatar
Ultra Talker

Posts: 321
Trades: 0
Like blackfalcon wrote you can use PHP. For redirection on right page you need one more line.

PHP Code:
<?php
if($_SERVER['HTTP_HOST'] == '209.123.147.87') {
$self $_SERVER['PHP_SELF'];
header("Location:http://www.technologyforever.com" $self);
}
?>
Shivaji
__________________

Please login or register to view this content. Registration is FREE
- uncommon free scripts

Please login or register to view this content. Registration is FREE
- Städte, Sport, Party, Gourment, Apartments, Hotels

Last edited by shivaji; 08-16-2007 at 08:17 AM..
shivaji is offline
Reply With Quote
View Public Profile Visit shivaji's homepage!
 
Old 08-16-2007, 09:31 AM Re: How can I make it so that my site has to be a domain name
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
Quote:
Originally Posted by goheadtry View Post
A bit od at what id does to mod rewrite on urls

http://209.123.147.87/game1.html

click that and watch what happens to the file name on the url
Place this rewrite rule BEFORE the other rewrite rules you have.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How can I make it so that my site has to be a domain name
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32609 seconds with 12 queries