LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-22-2013, 10:01 AM   #1
call_krushna
Member
 
Registered: Aug 2007
Location: India
Distribution: Ubuntu
Posts: 173

Rep: Reputation: 1
accessing website with apache only by domain name


Hi Team,

Need to block accessing our site using ip address .

It should be only accessible with name i.e www.goodworks.com and it should not be availabe with ip address .

My server ip 10.0.0.50 .

I have tried like , created a .htaccess and added

order allow,deny
deny from 10.0.0.50
allow from all

Not working .

My purpose is ,if somebody hits the ip 10.0.0.50 ,nothing should come in browser .

Any help is highly appreciable .
thanks in advance .
 
Old 03-22-2013, 10:28 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
that's absolutely NOT what the allow statement is for.

There are plenty of ways to do this, mod_rewrite or some such. Personally I'd suggest using a dumym default virtualhost, especially if you already have the site correctly set up with a a virtualhost anyway.

When you request a website with a virtualhost, apache will match the provided hostname to the apporpriate virtualhost definition. If none matches (e.g. if you only use an IP) then the FIRST ONE is used. So if that first one doesn't contain any content, then that's what they'll get.
 
Old 03-22-2013, 10:43 AM   #3
call_krushna
Member
 
Registered: Aug 2007
Location: India
Distribution: Ubuntu
Posts: 173

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by acid_kewpie View Post
that's absolutely NOT what the allow statement is for.

There are plenty of ways to do this, mod_rewrite or some such. Personally I'd suggest using a dumym default virtualhost, especially if you already have the site correctly set up with a a virtualhost anyway.

When you request a website with a virtualhost, apache will match the provided hostname to the apporpriate virtualhost definition. If none matches (e.g. if you only use an IP) then the FIRST ONE is used. So if that first one doesn't contain any content, then that's what they'll get.
Is the following block fine in adding virtualhost which will redirect any request to fqdn name

RewriteEngine on
RewriteRule ^/(.*)$ http://www.goodworks.com/$1 [R,L]
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to bypass squid for accessing website. gardenair Linux - Networking 19 05-11-2011 01:07 PM
Kerberos Issue Accessing Website scottyp55 Linux - Server 0 09-10-2010 01:36 PM
Problem in accessing website nitaish Linux - Software 1 05-02-2007 02:59 PM
problem accessing https website jagroop mand Linux - Enterprise 1 06-22-2005 09:30 AM
Accessing website from behind my own router theoldman Linux - Networking 3 05-23-2004 11:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration