Apache Server configuration support - Apache Directive in .htaccess

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > February 2006 > Apache Directive in .htaccess





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Apache Directive in .htaccess
David E. Ross

2006-02-20, 5:57 pm

My Web site is hosted by my ISP with an Apache 1.3.33 server. My
www.rossde.com domain points to www.vcnet.com/~rossde on that server.
That is, my home page <http://www.rossde.com/index.html> is actually at
<http://www.vcnet.com/~rossde/index.html>.

My site has pages directly at www.rossde.com and also pages in
directories under www.rossde.com. For example, while my home page is at
<http://www.rossde.com/index.html>, my main gardening page is at
<http://www.rossde.com/garden/index.html> (which is actually at
<http://www.vcnet.com/~rossde/garden/index.html> ).

I want search bots and crawlers to index my Web site only through my
www.rossde.com domain. My ISP suggested that I use the RewriteRule
directive to force bots looking at www.vcnet.com/~rossde to look instead
at www.rossde.com. However, I have been unable to get further
information from my ISP.

After reading the Apache documentation, I think the directive might be
(all on one line):
RewriteRule ^http://www.vcnet.com/~rossde$ http://www.rossde.com$
[redirect=permanent]

I'm afraid to implement this without someone else checking it for
correctness. Someone please review this and advise me.

--

David E. Ross
<http://www.rossde.com/>

Concerned about someone (e.g., Pres. Bush) snooping
into your E-mail? Use PGP.
See my <http://www.rossde.com/PGP/>
Robert Ionescu

2006-02-20, 5:57 pm

David E. Ross wrote:
> RewriteRule ^http://www.vcnet.com/~rossde$ http://www.rossde.com$
> [redirect=permanent]


The syntax is wrong. You must use a condition to check the host, it's
not available in the pattern. Where did you place the rule? In a
..htaccess located at http://www.vcnet.com/~rossde/.htaccess? If yes, the
~rossde part is not available as well

It should look like

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?vcnet\.com
RewriteRule ^(.*) http://www.rossde.com/$1 [R=301,L]

--
Robert
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com