Fallzone
03-28-2005, 05:46 AM
Heya guys i need some help with my url SEO.
Im currently trying to add .html and .htm extensions to my urls.
They currently looks like this
page 1
http://www.mywebpage.com/World-of-warcraft
another page in the same category
http://www.mywebpage.com/World-of-Warcraft-50
third page in the same category
http://www.mywebpage.com/World-of-Warcraft-100
But now i would like to add .htm extensions and so far i have only succeeded to add
RewriteRule ^.+\.html$ index.php [L]
RewriteRule ^.+\.htm*$ index.php [L]
to the htaccess file and left to fix is the php code which im a total newbie at.
i would greatly appreciate if someone could take a look at it
well heres the php code for creating the current urls
<?
if(!$cid) {
//Parameters
$Param = explode("/", $_SERVER['REQUEST_URI']);
$Param = array_slice($Param, 1);
$Param = explode("-", $Param[0]);
$ParFrom = $Param[count($Param) - 1];
$Param = array_slice($Param, 0, (count($Param) - 1));
$Category = implode(" ", $Param);
preg_match("/[a-z]/", $ParFrom, $matches);
if(count($matches) > 0) {
if(strlen($Category) > 0) {
$Category .= " " . $ParFrom;
}
else {
$Category = $ParFrom;
}
}
$Category = str_replace("_", "/", $Category);
$open = mysql_connect($dbhost, $user, $pass);
$data = mysql_db_query($dbname, "SELECT * FROM top_cats WHERE catname='$Category'");
if($rad = mysql_fetch_array ($data)) {
$cid = $rad['cid'];
}
else {
$cid = 0;
}
}
if (!$from) {
if(isset($ParFrom)){
$from = $ParFrom ".html";
}
else {
$from = 0;
}
}
?>
Im currently trying to add .html and .htm extensions to my urls.
They currently looks like this
page 1
http://www.mywebpage.com/World-of-warcraft
another page in the same category
http://www.mywebpage.com/World-of-Warcraft-50
third page in the same category
http://www.mywebpage.com/World-of-Warcraft-100
But now i would like to add .htm extensions and so far i have only succeeded to add
RewriteRule ^.+\.html$ index.php [L]
RewriteRule ^.+\.htm*$ index.php [L]
to the htaccess file and left to fix is the php code which im a total newbie at.
i would greatly appreciate if someone could take a look at it
well heres the php code for creating the current urls
<?
if(!$cid) {
//Parameters
$Param = explode("/", $_SERVER['REQUEST_URI']);
$Param = array_slice($Param, 1);
$Param = explode("-", $Param[0]);
$ParFrom = $Param[count($Param) - 1];
$Param = array_slice($Param, 0, (count($Param) - 1));
$Category = implode(" ", $Param);
preg_match("/[a-z]/", $ParFrom, $matches);
if(count($matches) > 0) {
if(strlen($Category) > 0) {
$Category .= " " . $ParFrom;
}
else {
$Category = $ParFrom;
}
}
$Category = str_replace("_", "/", $Category);
$open = mysql_connect($dbhost, $user, $pass);
$data = mysql_db_query($dbname, "SELECT * FROM top_cats WHERE catname='$Category'");
if($rad = mysql_fetch_array ($data)) {
$cid = $rad['cid'];
}
else {
$cid = 0;
}
}
if (!$from) {
if(isset($ParFrom)){
$from = $ParFrom ".html";
}
else {
$from = 0;
}
}
?>
