Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- http://xyz.com/ to http://www.xyz.com/


blogger - 8:48 pm on Apr 5, 2005 (gmt 0)


The code I hacked together seems slightly different from that in #11. I want to redirect everything under www.example.com to example.com:

www.example.com/adir/afile.html

should redirect to:

example.com/adir/afile.html

etc.

Note the caret in the last line of the rewrite code below: ^(.*) Should that be there, or should I remove it?

I also have a few other .htaccess files that have things like this in them:

RedirectPermanent /adir/index.html [a_different_domain.com...]

Will the "L" in the last line of the rewrite code have an effect on these other .htaccess files?

Should I consolidate all of my .htaccess files into one .htaccess file in the root, placing the RedirectPermanent's before the rewrite code? Or, does it not matter, and the "L" only applies to that one .htaccess file?

I tried the rewrite code out briefly and it seemed to work and the other redirects worked too, but I want to be sure before I leave it there for any length of time.

- BEGIN REWRITE CODE -
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} www.example.com
RewriteRule ^(.*)$ [example.com...] [R=301,L]
- END REWRITE CODE -


Thread source:: http://www.webmasterworld.com/apache/3267.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com