Closed Thread Icon

Topic awaiting preservation: changing *.html to *.php? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=30499" title="Pages that link to Topic awaiting preservation: changing *.html to *.php? (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: changing *.html to *.php? <span class="small">(Page 1 of 1)</span>\

 
CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 08-21-2008 17:36

So I am going to be adding some stuff to an existing website. No big deal but it is going to require some server side stuff. Since PHP is the only server side language I am comfortable with, this is what I'm going to use.

Now, that being said, what will happen with their rankings or say a google search when someone googles them? It will come up, www.mysite.com/index.html. Obviously if I click on this link to their site, it will not be there since it is now named index.php.

Anyone got a helpful tip on how not to screw up their rankings or whatnot?

Thanks in advance!

Later,

C:\

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 08-21-2008 18:07

mod_rewrite?

Blaise
Paranoid (IV) Inmate

From: London
Insane since: Jun 2003

posted posted 08-21-2008 18:57

you could create index.html and have it auto-redirect to index.php

twItch^
Maniac (V) Mad Scientist

From: Denver, CO, USA
Insane since: Aug 2000

posted posted 08-21-2008 22:20

If I'm not too much mistaken, search engine rankings are based on domain, generally, and the drill down doesn't occur unless the source document is NOT a standard default name (index.php, default.asp, etc).

I could be totally wrong on this one, but your ranking should not be affected by a change like this. Regardless, it's easiest to combat this by generating an XML sitemap file for Google. There are instructions on their Webmasters tools site (the url of which escapes me presently).

-S

bjwaters
Nervous Wreck (II) Inmate

From:
Insane since: Apr 2008

posted posted 08-22-2008 02:08

Setup a 301 re-direct to the new site. Shouldn't this also help out the indexing of search engines?

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 08-24-2008 00:34

well, I don't think I explained that very well ( I posted that while I was on vacation )

If you google the site
then you will see the second choice points to an *.html file. This is what I am concerned about really.

And by the way...I didn't do anything to this site as it is. The coding is bad.

Later,

C:\

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 08-25-2008 22:44

OK, this seems to work on one page:

code:
RewriteEngine on
RewriteRule ^test\.html$ test.php



How do I wild card it? I've tried

code:
RewriteEngine on
RewriteRule ^*\.html$ $1.php



and some others which all lead to a nice 500 error

Later,

C:\

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 08-25-2008 23:55

ok. This is working for me:

code:
RewriteEngine on
RewriteRule ^([a-z]+).html$ $1.php



it seems a bit slow on my testing server but if someone would look at it and see if there is a better way of doing this.

Thanks!

Later,

C:\

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 08-26-2008 10:42
code:
RewriteEngine on
RewriteRule ^([^.]+)\.html$ $1.php [R=301]



should be a tad bit more robust to 'funny filenames' and the 301 tells the search engines correctly that
the page has moved to .php - and that they should keep that in their index from now on.

So long,

->Tyberius Prime

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 08-26-2008 15:02

TP,

When I put your snippet in place it rewrites the entire URL. So if I call up say
http://myserver/1.html I need it to pull the page http://myserver/1.php. However that rule changes it to :
http://myserver/home/myuser/Web/www/htdocs/rewrite_test/1.php Which is the directory I have the files. Probably just my funky test server though

Here is what I did last night that pretty much takes care of all the pages. It doesn't change the file extension which is fine. But it does pull the PHP page.

code:
RewriteEngine on

# For any single word.html or 1.html
RewriteRule ^([a-z0-9]+).html$ $1.php [NC]

#This is for stuff like wood05.php
RewriteRule ([a-z]+[0-9]+).html$ $1.php [NC]

#This is for stuff like waiting_benches.php
RewriteRule ([a-z]+[_]+[a-z]+).html$ $1.php [NC]

#For stuff like wood-05.php and standard-plus.php
RewriteRule ([a-z]+[-]+[a-z0-9]+).html$ $1.php [NC]



It is a bit long but oh well. Is that OK? Should I put the R=301 in there too? If so, does it go [NC R=301]??

Thanks a lot for everything!

Later,

C:\

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 08-27-2008 15:02

Hm. You might need a RewriteBase /
command.

R=301 should really go in there - otherwise the search engines will a) never update their index
b) get confused because they see the same content under two different urls....

Don't ask me how to format it though, read the manual

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 08-27-2008 19:15

yeah, that was it. RewriteBase /mydirectory/ did the trick.

I also found how to do the R=301 with the NC. Was forgetting the comma

Later,

C:\

« BackwardsOnwards »

Show Forum Drop Down Menu