However, remember, you cannot send headers to the client after you've started sending page content. Either way, this method is always better than using the HTML tag, since it reduces talk-time between the client and the server.

Does answer you question?

.c

hgruber

Beginner

Posts: 58

Loc: Vero Beach Florida

3+ Months Ago

Actually, I want to redirect requests for the OldFile.HTML file to the NewFile.PHP automatically.
Or, at least display the link to the new location with a message advising that the previous HTML content has been permanently removed.

I just insert the meta tag into the new index.php document.
When the old index.html file is requested it auto refreshes.
Loads the new index.php in it's place?

That simple eh?
So each of 500 pages one by one?

Or, is there some way to mass alter the meta tags?
I suppose not since each meta tag contains each documents name on an individual basis

ATNO/TW

Super Moderator

Posts: 23473

Loc: Woodbridge VA

3+ Months Ago

No you insert it into the old file, not the new one. Given the number of pages you're talking about, you might want to check that mod rewrite link Carnix posted above.

Carnix

Guru

Posts: 1098

3+ Months Ago

You could probably also write a command line perl script to run through every file, find the <head> tag, add a newline, drop in the meta tag and another newline for any file with .html in the filename. Although, doing it by hand may be faster if you don't know Perl very well. I tend to go the route of writing the script and chalk it up to learning... but that's just me. Beware, directory recursion is a pain... but if you don't have very many directories to deal with, you could just write the script to only run on the current directory, and just move the script from directory to directory and run it each time.. I've don't something very similar dealing with adding title tags to every web file. I tried to find the script I used, but couldn't... it was really short, like 10 lines or something.

.c

Axe

Genius

Posts: 5735

Loc: Sub-level 28

3+ Months Ago

You could also just setup your 301 redirects in a .htaccess.

hgruber

Beginner

Posts: 58

Loc: Vero Beach Florida

3+ Months Ago

I have dabbled with some cgi scripting on scripts I downloaded.
But, that's the extent of my perl.
I did what I had to do to make the script work on my server.
Which as you probably know comes with instructions.
Not very accurate one's at that!

If you could locate the script it would at least give me something to go by.
A pattern to replicate/alter to my own needs.

I sure would appreciate it if you would try to locate it for me.

In the mean time I will visit the link you posted for me.

peace

and Thanx

hgruber

Beginner

Posts: 58

Loc: Vero Beach Florida

3+ Months Ago

Now, I was reading about the 301 redirects in the .htaccess file
But, there were some things I didn't quite understand with that.
It's probably not beyond the scope of my capabilities.
And sounds preferable to altering HTML code all day long and then some with 500+ pages to switch.

The other question I had was, I just drop the meta tag code into a file named as the old "filename.html" with the only line being the new meta tag in the old document?

or since it's a meta tag it doesn't matter if the original html remains within the doc because the meta tag is going to redirect it anyway.

So, theoretically I could make a line of code <meta tag> and drop it into a new empty html doc and delete all the original html documents. So long as the filename matched the old html filename.

Anyone be willing to offer guidance in the .htaccess file arena?
sonds more complex but, one files verses 500+.

Now that sounds more like where I want to be.

peace

Carnix

Guru

Posts: 1098

3+ Months Ago

hgruber wrote:

So, theoretically I could make a line of code <meta tag> and drop it into a new empty html doc and delete all the original html documents. So long as the filename matched the old html filename.

If you want to add DOCTYPE and all that, to be even MORE correct... it wouldn't hurt. Nevertheless, you're still going to have to create the meta tag custom for each page regardless of whether you're open the existing and pasting the tag, or creating a new file and overwriting the old one....

htaccess will probably be easier... although... I'd ask whether it's actually necessary to redirect all files. Is this site extensively linked to from other sites or bookmarked? If so, which pages? All of them? If might reduce the work to only redirect pages that really need to be redirected, and just convert the rest to PHP with a custom error page that explains that the site has been converted... etc. You could probably even use that page to give them a link to the new PHP file (take the requested, but not found file and use PHP or CGI or something to replace the .html with .php and present that as a link on the error page...)

.c

hgruber

Beginner

Posts: 58

Loc: Vero Beach Florida

3+ Months Ago

some of the pages are posted as Legal Documents & Legal Public Notices
So, it is essential these are re/located on say a google search or when anything like that is done.

Actually this is my biggest concern.

I am thinking I am just going to change everything to PHP and let it ride, let the chips fall where they may.

If you want to add DOCTYPE and all that, to be even MORE correct... it wouldn't hurt. Nevertheless, you're still going to have to create the meta tag custom for each page regardless of whether you're open the existing and pasting the tag, or creating a new file and overwriting the old one....
=======================
=======================

I was thinking just use a blank dreamweaver html file and insert the proper filenames into each meta tag for the individual documents I absolutely need to be redirected.

For instance, the Legal Docs & Public Notices I mentioned.

peace

hgruber

Beginner

Posts: 58

Loc: Vero Beach Florida

3+ Months Ago

okay I added the meta tag to the index.html and it worked.

But, I added code for index2.html, and index3.html and they were redirected to index.php.

I am guessing this redirect just refreshes the directory and opens the index.php file rather than pointing it to the new index2.php, index3.php file.

Carnix

Guru

Posts: 1098

3+ Months Ago

You have to put change the tag based on the file you want to redirect to...

There's also a JavaScript method that might work... though it wouldn't require end users to have Javascript... it would, however be more dynamic.

You can get the location of the current window, use a regex to switch the .html to .php, then location.replace(); using the modified URL... Again, it would require JS to be enabled on the client.

.c

hgruber

Beginner

Posts: 58

Loc: Vero Beach Florida

3+ Months Ago

Yes, I thought I had done that.

But, I looked back into the code and saw I had not.
I merely copied and pasted the meta tag from the first index.html and forgot to edit it.

My fault!!!
Doh!!!

Thanks again,

peace

hgruber

Beginner

Posts: 58

Loc: Vero Beach Florida

3+ Months Ago

now, I have a mirror I am setting up.

obviously the <meta http-equiv="Refresh" content="10;url=http://www.domain.com/index2.php"> won't work for that machine as with directory structure there can I just add the filename thus <meta http-equiv="Refresh" content="10;url=index2.php">

Carnix

Guru

Posts: 1098

3+ Months Ago

Yes, you don't need to specify the domain.
Again, though, I would remove the 10, which means the redirect will wait 10 seconds and replace it with 0, which will tell the browser to redirect as fast as possible. (nearly instantly, once a page has been cached, since the browser will remember the redirect on it's own.. at least, IE does anyway).
.c

hgruber

Beginner

Posts: 58

Loc: Vero Beach Florida

3+ Months Ago

Yep, I'm all over it boss!
I tried it and it happened!
Some of the pages I already did copy and paste got the 10 second refresh. But, I caught it and made them "0" seconds from now on.