How does a 302 redirect affect ranking/indexing on the same domain? For instance: http://www.domain.com/dir1/ 302 redirects to: http://www.domain.com/dir1/index.html And links are pointing to the index.html and may be pointing to the directory url. I've seen articles discussing 302 redirects across domains (aka 302 hijacking or moving websites). But, as anyone had any experience with it on the same domain? Regards, Maverick
302 redirect is supposed to be temporary. If the redirection is not temporary, you'd better to use a 301 redirect. Cleaner for engines.
I lost some indexed pages because I did not understand 301=permanent and 302=temporary. The SE according to what I have read always prefer a 301 and treat a 302 with suspicion.
As far as I can see you are trying to redirect a directory to itself, just changing the filename, perhaps actually reading index.php In which case it's enough add this to your .htaccess file: DirectoryIndex index.html index.php Code (markup):
Hi BasedSolutions, Thanks for the idea. The system 302 redirects a directory call, such as http://www.domain.com/dir/ to http://www.domain.com/dir/index.html So, your saying to use this on top? or instead of? Not sure if the redirect can be disabled, but it may be possible to use something a 301. Let me know which way you mean. Thanks again.
Hi Maverick, I meant use DirectoryIndex instead of mod_rewrite. You can try any of these methods, but making sure you are only using one of them in your .htaccess file RewriteEngine on RewriteCond %{HTTP_HOST} ^www.domain.com/dir$ [OR] RewriteCond %{HTTP_HOST} ^domain.com/dir$ RewriteRule ^(.*)$ http://www.domain.com/dir/index.html [R=301,L] Code (markup): DirectoryIndex index.html index.php Code (markup): or Redirect permanent /www.domain.com/dir/ http://www.domain.com/dir/index.html Code (markup): change permanent for temporal if that is the case, or [R=301,L] for [R=302,L] respectively in mod_rewrite
Thanks. So, am I correct in assuming that the first one looks out for (with the RewriteCond) the url directory string, with or without the www., and then the rule tells what to rewrite if those RewriteCond's are matched? And the DirectoryIndex doesn't do any redirects at all? Now, this is what happended in the rankings and indexing for the url. I only had linking to http://www.domain.com/dir/index.html, with the http://www.domain.com/dir/ redirect to the index.html page active. If I put http://www.domain.com/dir/index.html in google, it showed up. Then when it was ranking, it was top 1000, then got into the top 200. Then it dropped out of the top 1000. When I then went to see it was indexed, http://www.domain.com/dir/index.html didn't show up in google. However, if I do www.domain.com/dir/index.html or www.domain.com/dir/ or any substantial piece of the string, it shows up! And the cache is up to date! So, with all that, wondering if this caused by the redirect? Thoughts? And thanks again for your help.