Jump to content

Edit All Pages From One File


Tony M

Recommended Posts

Ok, I searched "Google" and find that there is a way to redirect (301) pages of .html to .php using .htaccess ( http://www.isitebuild.com/301-redirect.htm ), do this work? (If Yes, I think I would change all My files extension to .php and use this .htaccess code) :)

 

RewriteEngine on
RewriteBase /
RewriteRule (.*).html$ /$1.php

 

That would work but that's going to redirect ANY .html request to the .php version. Do you really want ALL .html request redirected?

 

Are you depeding on your Google rankings to make you any money? If your not, then I would just change all of the extensions (if that's what you really want to do) and not redirect at all. I myself would probably just go with the .htaccess, but it's totally up to you what you want to do.

 

Link to comment
Share on other sites

Ok, I searched "Google" and find that there is a way to redirect (301) pages of .html to .php using .htaccess ( http://www.isitebuild.com/301-redirect.htm ), do this work? (If Yes, I think I would change all My files extension to .php and use this .htaccess code) :)

 

That would work but that's going to redirect ANY .html request to the .php version. Do you really want ALL .html request redirected?

 

Are you depeding on your Google rankings to make you any money? If your not, then I would just change all of the extensions (if that's what you really want to do) and not redirect at all. I myself would probably just go with the .htaccess, but it's totally up to you what you want to do.

 

(I do not want any money from My website, I only want things to work)

 

Thanks for Your Help, Ok I will use the code that You showed Me at "Post #14" :D

 

AddHandler application/x-httpd-php5 .html .htm (in .htaccess)

 

(If I experience some errors in this code, I will re-post the problem) :)

Link to comment
Share on other sites

I would recommend SSI. It handles exactly what you're looking for, without much overhead.

 

I have this last question :wacko: : When using SSI , do I need to change My files extension to .php or it will work even if the extensions still .html ? :)

Link to comment
Share on other sites

I would recommend SSI. It handles exactly what you're looking for, without much overhead.

 

I have this last question :wacko: : When using SSI , do I need to change My files extension to .php or it will work even if the extensions still .html ? :)

.shtml

There's a tutorial teaching SSI on the bottom of that Wikipedia article.

Link to comment
Share on other sites

You also have two other options that will allow you to keep the .html extension with SSI.

 

Option 1. Add this to your .htaccess file:

 

AddHandler server-parsed .html

 

Option 2. Add this to your .htaccess file:

 

XBitHack on

 

and chmod your html files that have SSI to 744.

 

 

Link to comment
Share on other sites

Tony here's a script I wrote that uses the php rename function. You can run this php script inside each of your directories. What it does is look for any file that ends in .html and will rename it to .php or .shtml dependng on what you choose to do.

 

<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if ( preg_match("#(\.html)$#i", $file) ) {

$extract = pathinfo($file);
$ext = ($extract['basename']);
$fn = ($extract['filename']);

# to rename to php uncomment line below 
# rename("$file", "$fn.php");

# to rename to .shtml uncomment line below 
# rename("$file", "$fn.shtml");

echo "Renamed: $file<br>";

}
}
}
closedir($handle);
}
?>

 

That should make it allot easier to rename ALL html files in a directory if you choose to go that route.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...