User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Linux Servers and Apache section within the Tech Talk category of DaniWeb, a massive community of 429,791 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,817 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Linux Servers and Apache advertiser: Programming Forums
Views: 7422 | Replies: 12
Reply
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,972
Reputation: cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice 
Rep Power: 32
Solved Threads: 117
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Apache redirection?

  #1  
Mar 20th, 2004
How can I have all URLs under http://daniweb.com redirect to http://www.daniweb.com for SEO purposes?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2003
Location: Jersey - You gotta problem wit dat?
Posts: 334
Reputation: TheOgre has a spectacular aura about TheOgre has a spectacular aura about TheOgre has a spectacular aura about 
Rep Power: 8
Solved Threads: 5
TheOgre's Avatar
TheOgre TheOgre is offline Offline
Posting Whiz

Re: Apache redirection?

  #2  
Mar 21st, 2004
You could either use a redirector script (not the best way to do it) or you could make sure your httpd.conf has www.daniweb.com as the ServerName instead of just daniweb.com (if you have control over your server.) My guess is that your httpd.conf has just daniweb.com, but since I don't know too much about your configuration, I'm just guessing there :)
If you spend more on coffee than on IT security, you will be hacked.
What's more, you deserve to be hacked.
-- former White House cybersecurity czar Richard Clarke
Reply With Quote  
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,972
Reputation: cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice 
Rep Power: 32
Solved Threads: 117
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Apache redirection?

  #3  
Mar 22nd, 2004
My httpd.conf file does, indeed, have www.daniweb.com as a VirtualHost
I tried adding daniweb.com as well, and that just completely failed - every access to the page was running in circle doing infinite redirects between the two VirtualHosts.

I am pretty sure what I want can be done with .htaccess though. Could someone give me a heads up about that?
Reply With Quote  
Join Date: Feb 2003
Location: London, England
Posts: 281
Reputation: Roberdin will become famous soon enough Roberdin will become famous soon enough 
Rep Power: 7
Solved Threads: 6
Colleague
Roberdin Roberdin is offline Offline
Supreme Evil Overlord

Re: Apache redirection?

  #4  
Mar 22nd, 2004
And I thought you were the pc gal. You disappoint me Dani...

Reply With Quote  
Join Date: Aug 2003
Location: Jersey - You gotta problem wit dat?
Posts: 334
Reputation: TheOgre has a spectacular aura about TheOgre has a spectacular aura about TheOgre has a spectacular aura about 
Rep Power: 8
Solved Threads: 5
TheOgre's Avatar
TheOgre TheOgre is offline Offline
Posting Whiz

Re: Apache redirection?

  #5  
Mar 23rd, 2004
Personally, I don't use .htaccess if I can do it in httpd.conf. Even the folks over at Apache suggest that. But I digress...

I just did a "dig" on both domains, and found some differences in the results (which should be the same, since they're both on the same box, same server, etc.)

Here's the stdout of daniweb.com:


kevin@Cerberus$ dig http://daniweb.com
; <<>> DiG 8.3 <<>> http://daniweb.com
;; res options: init recurs defnam dnsrch
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 2
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUERY SECTION:
;; http://daniweb.com, type = A, class = IN
;; AUTHORITY SECTION:
com. 1h26m24s IN SOA a.gtld-servers.net. nstld.verisign-grs.com. (
1080019309 ; serial
30M ; refresh
15M ; retry
1W ; expiry
15M ) ; minimum

;; Total query time: 18 msec
;; FROM: Cerberus.geekis-kahn.net to SERVER: default -- 167.206.3.166
;; WHEN: Tue Mar 23 13:18:19 2004
;; MSG SIZE sent: 36 rcvd: 109

Here it is for www.daniweb.com:


kevin@Cerberus$ dig http://www.daniweb.com
; <<>> DiG 8.3 <<>> http://www.daniweb.com
;; res options: init recurs defnam dnsrch
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 2
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUERY SECTION:
;; http://www.daniweb.com, type = A, class = IN
;; AUTHORITY SECTION:
daniweb.com. 1h25m33s IN SOA ns.propagation.net. hostmaster.propagation.net. (
2003103121 ; serial
1D ; refresh
2H ; retry
5w6d16h ; expiry
8H ) ; minimum

;; Total query time: 19 msec
;; FROM: Cerberus.geekis-kahn.net to SERVER: default -- 167.206.3.166
;; WHEN: Tue Mar 23 13:19:42 2004
;; MSG SIZE sent: 40 rcvd: 105

It doesn't matter how many times I redo it, I always get the same results for both. The DNS servers for www.daniweb.com are different than for daniweb.com, along with the settings for expiry, etc. I don't know that that's the answer you're looking for, but it's a start, at least. I'll do some further checking later today after I get back from a service call and let you know if I can *dig* up any more info :)
If you spend more on coffee than on IT security, you will be hacked.
What's more, you deserve to be hacked.
-- former White House cybersecurity czar Richard Clarke
Reply With Quote  
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,972
Reputation: cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice 
Rep Power: 32
Solved Threads: 117
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Apache redirection?

  #6  
Mar 23rd, 2004
My httpd.conf file ony has an entry for www.daniweb.com ... :/ Is this "dig" a result of Network Solutions / Verisign as my registrar, or my host? I'm on a dedicated server. But I'm confused now
Reply With Quote  
Join Date: Aug 2003
Location: Jersey - You gotta problem wit dat?
Posts: 334
Reputation: TheOgre has a spectacular aura about TheOgre has a spectacular aura about TheOgre has a spectacular aura about 
Rep Power: 8
Solved Threads: 5
TheOgre's Avatar
TheOgre TheOgre is offline Offline
Posting Whiz

Re: Apache redirection?

  #7  
Mar 23rd, 2004
Basically, dig is a DNS lookup utility. I just tried it again with the T_ANY switch, and here's the stdout:


kevin@Cerberus$ dig T_ANY daniweb.com
; <<>> DiG 8.3 <<>> T_ANY daniweb.com
;; res options: init recurs defnam dnsrch
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 6, ADDITIONAL: 2
;; QUERY SECTION:
;; daniweb.com, type = A, class = IN
;; ANSWER SECTION:
daniweb.com. 4H IN A 69.13.146.64
;; AUTHORITY SECTION:
daniweb.com. 4H IN NS ns2.propagation.net.
daniweb.com. 4H IN NS ns3.propagation.net.
daniweb.com. 4H IN NS ns4.propagation.net.
daniweb.com. 4H IN NS ns.propagation.net.
daniweb.com. 4H IN NS ns1.lax.propagation.net.
daniweb.com. 4H IN NS ns2.lax.propagation.net.
;; ADDITIONAL SECTION:
ns2.lax.propagation.net. 3h27m28s IN A 66.34.193.2
ns4.propagation.net. 1h23m21s IN A 63.249.128.203
;; Total query time: 72 msec
;; FROM: Cerberus.geekis-kahn.net to SERVER: default -- 167.206.3.166
;; WHEN: Tue Mar 23 13:42:18 2004
;; MSG SIZE sent: 29 rcvd: 203

This is for www.daniweb.com:


kevin@Cerberus$ dig T_ANY www.daniweb.com
; <<>> DiG 8.3 <<>> T_ANY www.daniweb.com
;; res options: init recurs defnam dnsrch
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 6, ADDITIONAL: 3
;; QUERY SECTION:
;; www.daniweb.com, type = A, class = IN
;; ANSWER SECTION:
www.daniweb.com. 4H IN A 69.13.146.64
;; AUTHORITY SECTION:
daniweb.com. 4H IN NS ns1.lax.propagation.net.
daniweb.com. 4H IN NS ns2.lax.propagation.net.
daniweb.com. 4H IN NS ns2.propagation.net.
daniweb.com. 4H IN NS ns3.propagation.net.
daniweb.com. 4H IN NS ns4.propagation.net.
daniweb.com. 4H IN NS ns.propagation.net.
;; ADDITIONAL SECTION:
ns1.lax.propagation.net. 3h49m27s IN A 66.34.193.1
ns2.lax.propagation.net. 3h12m42s IN A 66.34.193.2
ns4.propagation.net. 1h8m35s IN A 63.249.128.203
;; Total query time: 96 msec
;; FROM: Cerberus.geekis-kahn.net to SERVER: default -- 167.206.3.166
;; WHEN: Tue Mar 23 13:57:04 2004
;; MSG SIZE sent: 33 rcvd: 223


The DNS servers appear to be the same for both domains on this search. Let me do some more *cough* digging *cough* and I'll let you know...
If you spend more on coffee than on IT security, you will be hacked.
What's more, you deserve to be hacked.
-- former White House cybersecurity czar Richard Clarke
Reply With Quote  
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,972
Reputation: cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice 
Rep Power: 32
Solved Threads: 117
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Apache redirection?

  #8  
Mar 23rd, 2004
OK Cool thanks. propagation.net is my webhost where I have a dedicated server. (Well, duh, that info was obvious already). But, yeah, either in .htaccess or via httpd.conf I'd like to have daniweb.com redirect to www.daniweb.com
Reply With Quote  
Join Date: Aug 2003
Location: Jersey - You gotta problem wit dat?
Posts: 334
Reputation: TheOgre has a spectacular aura about TheOgre has a spectacular aura about TheOgre has a spectacular aura about 
Rep Power: 8
Solved Threads: 5
TheOgre's Avatar
TheOgre TheOgre is offline Offline
Posting Whiz

Re: Apache redirection?

  #9  
Mar 23rd, 2004
Originally Posted by cscgal
My httpd.conf file does, indeed, have www.daniweb.com as a VirtualHost

Is it a VirtualHost or the ServerName? It actually does make a difference...
If you spend more on coffee than on IT security, you will be hacked.
What's more, you deserve to be hacked.
-- former White House cybersecurity czar Richard Clarke
Reply With Quote  
Join Date: Aug 2003
Location: Jersey - You gotta problem wit dat?
Posts: 334
Reputation: TheOgre has a spectacular aura about TheOgre has a spectacular aura about TheOgre has a spectacular aura about 
Rep Power: 8
Solved Threads: 5
TheOgre's Avatar
TheOgre TheOgre is offline Offline
Posting Whiz

Re: Apache redirection?

  #10  
Mar 23rd, 2004
Also, do you have mod_rewrite enabled/compiled?
If you spend more on coffee than on IT security, you will be hacked.
What's more, you deserve to be hacked.
-- former White House cybersecurity czar Richard Clarke
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Linux Servers and Apache Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the Linux Servers and Apache Forum

All times are GMT -4. The time now is 4:25 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC