Forum Moderators: phranque
(update)
sorry, i would specify my question: can this htaccess affect in bad way the ranking in searchenginges
thank you
[edited by: engine at 11:51 am (utc) on Nov. 25, 2008]
[edit reason] please always use example.com [/edit]
That is far too vague to be helpful in any way.
.
One thing is that your redirects are not in the correct order. The general non-www to www redirect should always be the last of the redirects.
Split the code up with a blank line between each rule block, and add a comment line to the start of each block explaining what that rule does.
You have the rewrite listed first. All of the rewrites must appear after all of the redirects.
¦ RewriteCond %{SERVER_PORT} =443
¦ RewriteRule ^robots\.txt robots_ssl.txt [L]
+--------------------------------------------
this rule gives the searchengines an another robots.txt if 443 is the requested port.
¦RewriteCond %{HTTP_HOST} !^192.168.0.10(:80)?
¦RewriteCond %{HTTP_HOST} !^www\.example\.com
¦RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
+-----------------------------------------------------
i think, here should redirect the request to the full address. if ip-request or non-www should go www. correct?
but is the ip-redirect required? and whats up with the portnumber und the question mark at the end of the line?
¦RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(html?¦php)\ HTTP/
+-----------------------------------
index.html or index.php should redirect to root. okay?
¦RewriteCond %{SERVER_PORT} !=443
¦RewriteCond %{REQUEST_METHOD} !^POST
¦RewriteRule ^index\.(html?¦php) http://www.example.com/ [R=301,L]
+-----------------------------------------------------
i don't know what happens here. it's a mytery for me.
seems to be duplicate with the rule above?
my webmaster is in vacation for three weeks and he created this htaccess. my guess is, that something doesn't works properly.
if someone can help me, i would be grateful for the informations.
thanks
[edited by: engine at 11:51 am (utc) on Nov. 25, 2008]
[edit reason] please always use example.com [/edit]
the (:80)? is an optional port specification in the url.
80 is the typical http port and the () groups it and the ? makes it 0 or 1 occurrence of the group.
the last two RewriteCond directive prevent the redirect to root if a form is submitted (the http request method for a submitted form is usually a POST, as opposed to a GET) or if it is a secure request (443 is the typical https port) and then the RewriteRule does the work.
the first RewriteCond only sets the condition for executing the following 2 RewriteCond directives and then the RewriteRule.
RewriteEngine on
#
# Redirect non-POST requests for index.php, index.html, or index.htm to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(html?¦php)\ HTTP/
RewriteCond %{REQUEST_METHOD} !^POST
RewriteCond %{SERVER_PORT}s ^(443(s)¦[0-9]+s)$
RewriteRule ^index\.(html?¦php[b])$[/b] ht[b]tp%2:[/b]//www.example.com/ [R=301,L]
#
# If requested hostname is not IP address, exact canonical domain, or
# blank (for HTTP/1.0), redirect requests to canonical domain
RewriteCond %{HTTP_HOST} !^192.168.0.10[b]$[/b]
RewriteCond %{HTTP_HOST} !^(www\.example\.c[b]om)?$[/b]
RewriteCond %{SERVER_PORT}s ^(443(s)¦[0-9]+s)$
RewriteRule (.*) ht[b]tp%2:[/b]//www.example.com/$1 [R=301,L]
#
# Serve alternate robots.txt for SSL requests
RewriteCond %{SERVER_PORT} =443
RewriteRule ^robots\.txt robots_ssl.txt [L]
Important: Change the broken pipe "¦" characters to solid pipe characters before use; Posting on this forum modifies the pipe characters.
Jim