|
Replacing the old index.html with index.php
|
MWpro
#:3558947
| 2:46 am on Jan. 27, 2008 (utc 0) |
Before I uploaded my forum, I put up a "Coming Soon" page named index.html so that google could start to find my site and index it. When I installed my forum, I deleted the index.html page. The main page is now index.php. However, google still has the old index.html page indexed, and is indexing the index.php page as a separate page. This is affecting my ranking because google is not indexing the main page of my new site. Any suggestions? [edited by: MWpro at 2:47 am (utc) on Jan. 27, 2008]
|
g1smd
#:3559193
| 7:30 pm on Jan. 27, 2008 (utc 0) |
You should be referring to your site root as purely www.domain.com/ without the actual index file filename included. Additionally, any access to a named index page URL should issue a 301 redirect back to the root URL ending with the / at the end. This avoids that problem, as well as any potential Duplicate Content issues that could arise.
|
Robert Charlton
#:3559241
| 10:10 pm on Jan. 27, 2008 (utc 0) |
Additional details on these two threads... Merging www.example.com/ and www.example.com/index.htm Itwould be helpfull to a few of us if this where added to sitemaps too http://www.webmasterworld.com/google/3037886.htm Split pagerank on index.htm Split pagerank on index.htm http://www.webmasterworld.com/google/3417776.htm Both of the above cover index.php as well. You might also want to read the threads on Duplicate Content in [url=http://www.webmasterworld.com/google/3269983.htm]Google Hot Topics[/url], pinned to the top of the home page of this forum.
|
MWpro
#:3561273
| 8:12 pm on Jan. 29, 2008 (utc 0) |
Thank you! Right now this is what my .htaccess looks like. Will this solve my problem? Thanks! DirectoryIndex index.php RewriteEngine On rewritecond %{http_host} ^mysite.com rewriteRule ^(.*) http://www.mysite.com/$1 [R=301,L] Redirect 301 /index.html http://www.mysite.com/ |
|
|
g1smd
#:3561305
| 8:28 pm on Jan. 29, 2008 (utc 0) |
No. It uses a double redirect from non-www to www and then again to remove the index file filename. That is not a good idea. Avoid redirection chains. Additionally, you should not mix up directives from different modules. Don't use Redirect for one part and RewriteRule for the other part. You will not be able to control the order the directives are processed. Use RewriteCond for both parts, and do the more specific redirects first. Make sure that the redirect goes direct to the target URL in ONE step, not in multiple steps. Finally, your index redirect only works for index files in the root. You should set it up so that it works for all index files in any depth of folder too; and preserves the folder path in the redirect.
|
MWpro
#:3561728
| 6:32 am on Jan. 30, 2008 (utc 0) |
Found this in the thread: RewriteEngine on RewriteCond %{THE_REQUEST} ^.*\/index\.php RewriteRule ^(.*)index\.php$ http://www.example.com/$1 [R=301,L] Will this fix it? I also had the other code to direct mysite.com to www.mysite.com How can I do this both? .htaccess is not my strong suit so as much help as you can give me would be appreciated. [edited by: tedster at 7:24 am (utc) on Jan. 30, 2008] [edit reason] switch code to example.com - it can never be owned [/edit]
|
JohnDoealias
#:3561889
| 12:51 pm on Jan. 30, 2008 (utc 0) |
yeah, I would appreciate, too.
|
g1smd
#:3561915
| 1:09 pm on Jan. 30, 2008 (utc 0) |
1. Redirect index filenames on www and non-www over to www without the index file filename included. Preserve any folder path in the redirect. This rule runs only for index files, but fixes the www at the same time. 2. Redirect all non-www to www, preserving any folder path. This rule runs for non-www URLs, but does not run for index files at non-www because rule 1 has already fixed them up to be completely correct, in one step. If you reversed rule 2 and rule 1 you would have a redirection chain for non-www index files. You must avoid that happening. The order, above, is the correct one to use. Example code has been posted in the apache forum hundreds of times, and is linked from the sticky thread at the top of that forum.
|
MWpro
#:3562330
| 9:18 pm on Jan. 30, 2008 (utc 0) |
Fyi, there is no sticky in the Apache forum. How is this looking: DirectoryIndex index.php RewriteEngine on RewriteCond %{THE_REQUEST} ^.*\/index\.html RewriteRule ^(.*)index\.html$ http://www.example.com/$1 [R=301,L] RewriteEngine On rewritecond %{http_host} ^example.com rewriteRule ^(.*) http://www.example.com/$1 [R=301,L] |
| [edited by: MWpro at 9:25 pm (utc) on Jan. 30, 2008]
|
Robert Charlton
#:3562404
| 11:45 pm on Jan. 30, 2008 (utc 0) |
| Fyi, there is no sticky in the Apache forum. |
| Try the small Library link up above the messages at the top of that forum's home page. I believe it can be sorted by older or newer threads first.
|