home page links

Status
Not open for further replies.
#1
Although my current home page is mydomain/index.php I've still got a lot of old back links to mydomain/index.htm out in the world wide web. These generate 404's which I'd like to avoid. Putting a 301 redirect in my htaccess file screws up my subdomains because they still use index.htm. What is the best way of dealing with this situation? Should I create a dummy index.htm with a simple redirect in it, or is there a better way?
 
#2
Think about it.
The homepage should not be index,html nor index.php . It should be just "/" - i.e. the root of the domain.

The same for folders - their index page is really just the folder with a trailing slash.

So the typical mod_rewrite redirection can easily be written to cover both cases and apply everywhere.



<Ifmodule mod_rewrite.c>
Options +Indexes +FollowSymlinks
RewriteEngine on
RewriteBase /


### re-direct index.html to root / ###
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ /$1 [R=301,L]

### re-direct index.php to root / ###
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]


### re-direct non-www to www
rewritecond %{http_host} ^example.com [nc]
rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc]
####
</Ifmodule>
 
Last edited:
#4
A 404 is a 404. When a search engine gets the 404 it's good-bye.

To cash in on the broken backlink you need to 301 redirect it where it's useful.
 
#5
I had a feeling I hadn't asked the question correctly. :wink:

I have been using this to redirect old links to my new home page ...

Redirect permanent /index.htm http*//w*w.mydomain/index.php

This is stopping traffic getting my subdomains. How should I be doing it? :)
 
#6
Old links from where?

The subdomains have their own root folder and by themselevs are not affected by whatever you do in the domain's folder.

If you access the domain's folder corresponding to the subdoamin then youa re subject to the domain's root folder .htaccess file thouhg.

Please give an example of what gets redirect by you - from where to where and how.
 
#7
A 404 is a 404. When a search engine gets the 404 it's good-bye.

To cash in on the broken backlink you need to 301 redirect it where it's useful.
A page is a page as far as the SEs go and a link is a link. You can put links in your 404 and run SSIs like you could with any .shtml page.
 
#8
Search engines don't receive a page when the return code is 404.
They do a head request first, if that's okey they do a get.

At least Google doesn't.

So any stuff you put there is for the benefit of pedestrian traffic only.
 
#9
Old links from where?
From people who like my site and have put links on theirs. Also some directories I submitted to eons ago that I can no longer access. Can I find an example? Not sure, but I'll wade back through my stats and see. Can't say I understand why the origin of the link is important though, surely dealing with it on my site will not be dependant on where it's come from.

If anyone tries to access my site using mydomain.net/ then the homepage is found just fine, as is the homepage of subdomain.mydomain.net/. Everything works fine under those circumstances. If anyone uses an old link written as mydomain.net/index.htm then a 404 is given. I'm sure it must be possible to redirect that circumstance without screwing up the subdomains. That's all I need. ;)
 
#12
From people who like my site and have put links on theirs. Also some directories I submitted to eons ago that I can no longer access. Can I find an example? Not sure, but I'll wade back through my stats and see. Can't say I understand why the origin of the link is important though, surely dealing with it on my site will not be dependant on where it's come from.

If anyone tries to access my site using mydomain.net/ then the homepage is found just fine, as is the homepage of subdomain.mydomain.net/. Everything works fine under those circumstances. If anyone uses an old link written as mydomain.net/index.htm then a 404 is given. I'm sure it must be possible to redirect that circumstance without screwing up the subdomains. That's all I need. ;)

My question referred to whether you wanted to redirect from an old hosting acount to the current one. I don't care who's got your site linked to or bookmarked LOL

If it's a redirection you want to do from somewhere where you can control it or not.

I guess I didn't say it right :lol: :oops:
 
#16
The subdomains have their own root folder and by themselevs are not affected by whatever you do in the domain's folder.
That's what I always thought, too, but I had the same problem with one of the subdomains on my site. I ended up enabling php-on-html and redirecting from that page. htaccess directives only resulted in a never-ending loop.

Might be a setting at the server level, but also consider that a subdomain is also a folder on the root level as well... :confused:
 
Status
Not open for further replies.
Top