hey frnds, I want to ask you both about Google Search Engine and Google AdSense…. I am little bit confused about safe redirect methods to use. I am buying 1 domain and I’ll need it to redirect permanently to my other website. So I want to ask you about “Which redirect method will be safe for both Search Engine and for Google Ad sense?†… As Google AdSense Policies clearly says that we can not use Sneaky Redirect for generating traffic. can any1 explain me what exactly is Sneaky Redirect? And I don’t want to break any rules/policies in any way. Domain which I am buying will be permanently redirected to another website. And that another website will having google AdSense. I am having Apache Server; please suggest me good method from which I can be sure that I am not violating any google AdSense policy. I am very fretful about my AdSense A/c and I don’t want it to get disable in any way…Please advice me. Chintan Soni
IMHO means what? please tell me from follwing 7 methods which is safe? in .htaccess 1. RedirectMatch 1. permanent ^(.*)$ http://www.new-url.com 2. RedirectMatch 301 ^(.*)$ http://www.new-url.com 3. Redirect 301 /old-file.htm http://www.mywebsite.com/new-file.htm 4. RedirectMatch permanent ^/directory_name http://www.domain.com 5. RedirectMatch permanent \.file_type$ http://www.domain.com 6. RedirectMatch 301 ^/directory_name http://www.domain.com/ 7. RedirectMatch 301 \.file_type$ http://www.domain.com/ Thanks in Advance...
IMHO = In My Honest Opinion A safe 301 redirect in your .htaccess file would look like this... RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.new-site\.com$ [NC] RewriteRule ^(.*)$ http://www.new-site.com/$1 [R=301,L] Code (markup): So what is this doing exactly? Well, first of all it's turning on the runtime rewriting engine (Apache module mod_rewrite) using the RewriteEngine On command. Next, it looks at the hostname portion of the url the person just tried to connect to using the RewriteCond directive. This is stored in the variable %{HTTP_HOST}. It looks at it and says "is this NOT equal to www.new-site.com?" (Notice the !, meaning NOT) The [NC] flag means No Case, and it's telling mod_rewrite to perform the comparison without regard to case. If the hostname is NOT www.new-site.com, then it knows to follow the rewrite rule you're about to give it. By the way, the ^ is the start of line anchor and the $ is the end of line anchor. It's basically telling the mod_rewrite module that we're giving it a regular expression. Also, the \ is there to specify the literal dot (.) character. If we just typed dot (.), that's regular expression speak for "match any single character", which is not what we want. So the RewriteRule goes to work and it takes any additional parameters we have appended to the end of the url and redirects the user to the new url with those parameters. So if a person types in... www.old-site.com/test it would redirect to... www.new-site.com/test You may be wondering, what the heck is this thing ^(.*)$? Well, as I said before the ^ specifies the start of a regular expression and the $ specifies the end of a regular expression. Inside we have a dot (.) and a star (*). The dot (.) matches any single character. If we put a start (*) after it, it tells it to match "0 or more" of the preceding character. So it basically matches *anything*. Then, you see it appends it to the new url using the $1 variable. The $1 is the first parameter that was passed (in our regular expression). Then, it tells it to issue the browser a 301 redirect code ([R=301, L]), and also it gives it the L flag ([R=301,L]) telling the rewrite engine that this is the Last rule. This tells the rewriting engine to stop the rewriting process and to not apply any more rewriting rules. It's important that we give it the R=301 flag because if we didn't it would use a 302 (moved temporarily) by default. As stated in the Apache docs... And in your case HTTP Status Code 301 (Moved Permanently) is what you want.