Forum Moderators: phranque

Message Too Old, No Replies

httpd.conf 301 redirect

page 301 redirect in httpd conf

         

koti

12:14 pm on Oct 18, 2010 (gmt 0)

10+ Year Member



Please help me! , I don not know anything about httpd conf, can any please tell me, how to do 301 redirect from one page to other page with in same domain and where i have to place that directive my httpd conf.

jdMorgan

1:29 pm on Oct 18, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



 RedirectMatch 301 ^/old-URL-path$ http://example.com/new-URL-path 

-or-
 RewriteRule ^/old-URL-path$ http://example.com/new-URL-path [R=301,L] 


The redirect directive needs to be placed into the correct VirtualHost container in your server config file. There is no way to tell you exactly where to put it, because you must understand your server configuration before you can decide where to put the directive.

Note that if the code is placed within a <Directory> container in a server config file, then the code itself may have to be changed. For example, if placed within a <Directory /> container, the RewriteRule above would have to be changed to
 RewriteRule ^old-URL-path$ http://example.com/new-URL-path [R=301,L] 

Note that the leading slash on the URL-path has been removed, because that part of the path is now handled by the <Directory /> directive.

I cannot recommend that you change your server configuration until you thoroughly understand your server, its configuration, and all of the Apache directives used to implement the configuration. Server configuration is not easy or safe, and several weeks spent studying your configuration along with the Apache documentation [httpd.apache.org] would be a good investment of your time.

Attempting to do otherwise could take your site offline immediately or slowly ruin your search rankings over time and put you out of business.

Jim