Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Canonicalization: best code to redirect no-www to www & index to /


ewwatson - 12:13 pm on Jan 13, 2013 (gmt 0)


Good morning,

99% of the time it's a moot thing I guess as I will always have a index in the root. The only reason I noticed it was because I just started developing it and took it live with no files. I was mainly just asking if this is normal behavior? I guees it is right? It redirects to folder if no index. I just figured it would not travel back down the folders looking for the first index.

The structure is like this... /public_html/maindomain.com/addondomain.com - the same for each addon.

Each addon domain is fully functional. They do already have their own htaccess.

Here is what I have in my addon domain htaccess...

# 301 permanent redirect index.php to folder
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http://www.exampledomain.com/$1 [R=301,L]

# 301 permanent redirect non-www (non-canonical) to www
RewriteCond %{HTTP_HOST} !^(www\.exampledomain\.com)?$
RewriteRule (.*) http://www.exampledomain.com/$1 [R=301,L]


Thanks


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