993ti
 
Reply Sun 24 Oct, 2004 06:52 pm
I was going through my server logs and noticed the 302 (Moved temporarily (redirect) has lots of hits.
I searched on google and found that search engines don't like those?
I moved to another host and finally got a domainname.
The domainname is http//domain.com but i can also use it with the www which is what most visitors use.

Could it be the domainname or maybe a server configuration?
Can i do something with htaccess?

My site is in the public_html folder and when using the www it redirects to the files in a www folder which is also in the public_html folder.

Thx in advance.
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 2 • Views: 2,013 • Replies: 13
No top replies

 
Craven de Kere
 
  1  
Reply Sun 24 Oct, 2004 07:29 pm
Re: 302 redirects??
993ti wrote:

My site is in the public_html folder and when using the www it redirects to the files in a www folder which is also in the public_html folder.


This is a sloppy server configuration.

You should have your host change the way this works (or get a better host).
0 Replies
 
993ti
 
  1  
Reply Sun 24 Oct, 2004 07:44 pm
Oops, my fault.
It's in the root together with public_html. Embarrassed
I'm using this in the htaccess file in public_html:
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

It works when using the adress without www but will this also work for search engines?
0 Replies
 
Craven de Kere
 
  1  
Reply Sun 24 Oct, 2004 11:27 pm
993ti wrote:
Oops, my fault.
It's in the root together with public_html. Embarrassed


That's a better way, the www is just a symbolic link to the public_html folder.

Quote:
I'm using this in the htaccess file in public_html:
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

It works when using the adress without www but will this also work for search engines?


Do you know what that code does? It's giving a 301 redirect for all your pages. 301 is usually best used when you really need to redirect.
0 Replies
 
993ti
 
  1  
Reply Mon 25 Oct, 2004 11:26 am
Craven de Kere wrote:
Do you know what that code does? It's giving a 301 redirect for all your pages. 301 is usually best used when you really need to redirect.

Well, i was getting 302 temporarily redirects all the time.
I read that search engines don't like that and can even penalize for that (don't know if that's true).

I switched host and got a domainname a month ago so not many hits without the www.
Should i try a different approach?
Grtz
0 Replies
 
Craven de Kere
 
  1  
Reply Mon 25 Oct, 2004 10:01 pm
A different approach for what? You have yet to state what you are trying to accomplish.
0 Replies
 
993ti
 
  1  
Reply Tue 26 Oct, 2004 12:37 pm
Well, i'm trying to get rid of the 302 redirect and use the 301 instead. :wink:
0 Replies
 
Craven de Kere
 
  1  
Reply Tue 26 Oct, 2004 10:11 pm
What redirect? What is the purpose of the redirect?

IMO, you are approaching this from the wrong angle. I suspect you are seeing 302's in your logs that you don't know much about and trying to eliminate them.

Alternately, you might try to find out what's causing them and why they are there.

Your logs should be enough to tell you.

Note that they can be coming from other sites.
0 Replies
 
Dramatic
 
  1  
Reply Wed 27 Oct, 2004 04:17 am
Re: 302 redirects??
993ti wrote:

The domainname is http//domain.com but i can also use it with the www which is what most visitors use.

The domain name is simply domain.com (the protocol http:// is not a part of it)

You need to check the DNS entries for your domain. Your name registrar may provide an interface for this. Make sure that your A record includes an alias www.domain.com as well as the straight domain.com (pointing to the same IP number)

There shouldn't be any need for a rewrite rule on the server, it should accept both domain.com and www.domain.com byy default.

Richard
0 Replies
 
Craven de Kere
 
  1  
Reply Wed 27 Oct, 2004 11:38 am
Re: 302 redirects??
Dramatic wrote:
You need to check the DNS entries for your domain. Your name registrar may provide an interface for this. Make sure that your A record includes an alias www.domain.com as well as the straight domain.com (pointing to the same IP number)

There shouldn't be any need for a rewrite rule on the server, it should accept both domain.com and www.domain.com byy default.

Richard


Richard has a good point. But check this with whomever runs the nameservers for your domain. Typically it's the host and not the registrar.
0 Replies
 
993ti
 
  1  
Reply Wed 27 Oct, 2004 11:50 am
Thx for the replies.
The 302 is caused when the www is used.
I read that a site got kicked from google because they had the 302 redirect.
I also understand that 301 redirect stands for permanently moved and the 302 for temporarily moved.

Bit confused now Embarrassed
0 Replies
 
LocanT
 
  1  
Reply Fri 29 Oct, 2004 04:08 am
I think I know what your trying to do

That of trying to ensure that the domain is only reachable by one way

ie only www.domain.com

and not domain.com as well

I guess that like me you read that it will concentrate PR to the one

phpbb do it themselves!

try typing in just phpbb.com

it will rewite to www.phpbb.com

Now I may too be making the same mistake if this is a negative

I used

Quote:
<Files .htaccess>
Order allow,deny
deny from all
</Files>
RewriteEngine on
RewriteCond %{HTTP_HOST} !^.*domain\.com [NC]
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

The first being cravens rewrite to stop ip being identified!(hopefully correctly done by me)

tell me please Craven is the latter bad(or not smart) practise then?

Plus the first method will this help stop ip identification with a third level or sub domain as well (as long as you do the full url for the domain) ?
0 Replies
 
Craven de Kere
 
  1  
Reply Sat 30 Oct, 2004 02:18 am
LocanT wrote:

The first being cravens rewrite to stop ip being identified!(hopefully correctly done by me)

tell me please Craven is the latter bad(or not smart) practise then?


1) It's redundant, only the second rule is needed as the second covers what the first one does.

2) If you have any subdomains, they won't work.
0 Replies
 
LocanT
 
  1  
Reply Sat 30 Oct, 2004 08:54 pm
Thanks for the reply Craven

please tell me is it Ok to do then?

The other thing was the sub domains (well to be precise in my case third level domains) Do work!


I use the full url and they do re write

Quote:
RewriteCond %{HTTP_HOST} !^www.abc.def.com$ [NC]
RewriteRule ^(.*)$ http://www.abc.def.com/$1 [R=301,L]


Just to be clear when you have a moment

I thought the second way was just rewriting without the www.

If I am reading you right? this does also cover a IP address as well then?
and I can get rid of the initial rule
0 Replies
 
 

Related Topics

In How much time a website can be developed? - Question by aussiejumpingcastle
Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » 302 redirects??
Copyright © 2021 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 09/20/2021 at 08:32:12