Forum Moderators: phranque

Message Too Old, No Replies

mod_alias Question

Is a permanent redirect the same as a 301 redirect in htaccess?

         

RandyRay

9:20 pm on Mar 15, 2006 (gmt 0)

10+ Year Member



I'm doing some SEO work for a company, and I've asked them to enter the htaccess file and do a 301 redirect from http://example.com/ to http://www.example.com/. Eventually I'll need to redirect several of the old URL's to new URL's too.

They don't want to do an htaccess script, and instead they directed me to this page: [httpd.apache.org...]

Does the RedirectPermanent Directive work exactly like a 301 in the htaccess file?

And if so, can it be used for mulitple pages?

jdMorgan

1:32 am on Mar 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, RedirectPermanent cannot do conditional redirects.

Tis may or may not be a problem, depending on the server configuration.

If www- and non-www currently resolve to the same VirtualHost, then you'll need to test %{HTTP_HOST} in order to suppress the redirect if the domain is already correct -- else you'll do a client-server infinite redirection loop until one or the other times out. You'd need to use mod_rewrite to do this.

If www and non-www are handled (or can be configured to be handled) as separate hosts, then a RedirectPermanent directive in the non-canonical domain's VirtualHost container (or top-level .htaccess file) can be used without problem.

Jim