Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing extensions 2

Status
Not open for further replies.

benluke4

Technical User
Jan 27, 2005
127
GB
not sure if this is appropriate forum but here goes.

Hi,

im rebuilding a site so it is easier/quicker to update. I will be changing little content but will be changing all of the .htm extensions to either .shtml or .php

Now this site has pretty good rankings on a fair few search engines. How do i do this without screwing the ranks UP??

Thanks

Ben
 
so clive you think there is no need to redirect?
 
If you change the extensions and do not use a redirect, The new pages could take from 6 weeks to possibly 6 months to stabilise and rank in the search engines. Especially where Google is concerned.
The pages with the old extension will remain in the index for quite some time.
If you have a custom 404 page, this can cause even more problems depending on how it is set up, and if you haven't, you are loosing visitors and confidence by showing broken pages from SERPs.

CliveC said:
You can change index.htm to index.php without affecting anything.
This is not strictly correct, especially where SEs are concerned. domain/index.htm and domain/ are seen as two distinct adresses so if your site has been indexed as domain/index.htm changing to index.php will result in a 404 error.


Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
Nightclub counting systems

So long, and thanks for all the fish.
 
Hi everyone thanks for all the advice i have learnt a great deal from this thread. so a 301 Permanent Redirect is the correct one to use.

How do i impliment this? I have no idea how to do this.

Any help / code is much appreciated.

Do i need a .htaccess file for every page? The site is about 35 pages.

Thanks

Ben

 
you will need a line in .htaccess for each page.

Code:
Redirect 301 /olddirectory/oldfile.ext htt*p://ww*w.domain.com/newdirectory/newfile.php
(the "*" are there to stop the forum auto-linking btw)

you could also use a RedirectMatch if you fancy writing a regular expression. But for 35 pages it probably isn't worth the effort.

the redirect only needs to be in place until the SEs have updated your URLs to the new ones and any backlinks you can change have been done. Check your referer logs after 3 months to see if any requests are being made for the old pages, If not, you can take down redirects and let any errors 404 out. You can of course put a custom 404 in place to catch these few as well.




Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
Nightclub counting systems

So long, and thanks for all the fish.
 
Cheers Chris,

Ive only used .htaccess once before so i just want to make sure i have this right

I put the .htaccess file in the public_html directory

and within the .htacces file i put the follwing code for each page specifying the old file name and new file name
Code:
Redirect 301 /public_html/index.htm htt*p://ww*w.domain.com/public_html/index.php
Redirect 301 /public_html/courses.htm htt*p://ww*w.domain.com/public_html/courses.php

Is that right? (removing the "*" of course)

Ben
 
Depending on how your server is set up you shouldn't need to specify public_html as that is probably the webroot "/"
I assume your site urls aren't

ww*w.domain.com/public_html/courses.htm
but
ww*w.domain.com/courses.htm

the redirect uses the URLs not the physical path.


Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
Nightclub counting systems

So long, and thanks for all the fish.
 

Redirect 301 /index.htm
htt*p://ww*w.domain.com/index.php
Redirect 301 /courses.htm
htt*p://ww*w.domain.com/courses.php

ok cool thanks alot

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top