Jump to content

mdedens

Members
  • Posts

    80
  • Joined

  • Last visited

mdedens's Achievements

Enthusiast

Enthusiast (6/14)

  • First Post
  • Collaborator
  • Conversation Starter
  • Week One Done
  • One Month Later

Recent Badges

0

Reputation

  1. Hello, I was wondering what the path to php is? Does this look correct? /usr/local/lib/php Thanks
  2. I have this URL, but can't get it to 301 redirect without appending variables to the end of the static URL. Is there a way around this? >redirect 301 /Default.asp?page=32 http://***DomainName***/about-us/ This only applies to a few URLs, so I just need an example of this specific URL 301 redirected. I also tried this to no avail: >RewriteRule ^Default.asp?page=32 /about-us/? [R=301,NC,L] Any advice is appreciated.
  3. Finally found what I needed... thanks again for all your help. It pointed me in the right direction >Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC] RewriteCond %{REQUEST_URI} ^/olddir/ RewriteCond %{QUERY_STRING} CAT=100&catName=Widgets RewriteRule ^(.*)$ http://***.newdomain.***/widgets.php? [R=301,L]
  4. Hi Click I gave it a try but the old page still shows up normally. Both directory.php and any version with strings of characters after it show up fine. Also, I only put the code given here in the htaccess.
  5. Hi Andy, Thanks for taking a crack at it. I tried the code, but still can't get it to work. The pages show up as normal. If this is going to be too complicated or time consuming to troubleshoot, is there an alternate method that could be used to redirect any URLs using that directory.php file. So any page that calls "directory.php" and no matter what comes after it, would redirect to one page on a new domain? like this URL: http://***.oldomain.***/olddir/directory.php?CAT=100&catName=Widgets would go to this URL: http://***.newdomain.***/directory.php'>http://***.newdomain.***/directory.php this URL: http://***.oldomain.***/olddir/directory.php?CAT=5654&catName=MoreWidgets would go to this URL: http://***.newdomain.***/directory.php Thanks again for your help!
  6. Hi, I have a 301 redirect setup in an old domain's htaccess file, but my URLs with "?" "&" and "%20" don't seem to be redirecting. So I thought I would ask the experts and see if anyone knows how to redirect a dynamic URL with special characters on an old domain to a static URL on new domain. (*** added so no URLs are in post) So I would like this URL: http://***.oldomain.***/olddir/directory.php?CAT=100&catName=Widgets To go to this URL: http://***.newdomain.***/widgets.php > Example: Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^olddomain\.com$ [NC] redirect 301 /olddir/directory.php?CAT=100&catName=Widgets http://***.newdomain.***/widgets.php Thanks for any advice!
  7. Got it working!! For anyone interested, here was the final redirect code: >RewriteRule ^products/Wall-Sconses_2_4.php /products/Wall-Sconces_2_4.php? [R=301,NC,L]
  8. New info... I tried adding this to the htaccess... added the L, >RewriteRule ^products/Wall-Sconses_2_4.php /products/Wall-Sconces_2_4.php? [L, R=301,NC] And when I go to any page in the gallery it throws a 500 Internal Server error. Is this info in any way helpfully diagnostic?
  9. I tried creating products/Wall-Sconses.php today, (thought maybe adding a header redirect would work), but the page itself doesn't even show up in the browser when I go to the URL. I removed all redirects, and the header redirect, added some text to the page, but when I go to the URL it's still just a blank white page, aka 404 error. Does this offer any insight into what could possibly be wrong? Maybe it is those other re-write rules in the htaccess... If anybody knows where I can go to get help with this, I can see about compensation for figuring this out.
  10. Yea, that extra "_1" was a typo... sorry about that one. Not sure what's up. I'm afraid the problem must be deeper than what it appears to be. I tried typing in the URL, but it's just a blank white page, aka 404 error without redirecting. http://www.****.com/products/Wall-Sconses_2_4.php
  11. I wonder if there is some type of server or php config problem. I arranged everything accordingly but just get a blank white page in Firefox. And the IE 404 error page when visiting in IE. So basically just a 404 error page. I don't mean to overwhelm with this, but I thought maybe it would be helpful to post some code that appears in the products/index.php page that generates every other page under the products dir. It may be that the long way has been taken to creating 404 error pages and may be preventing redirects. (This all appears before the HEAD tag) Maybe something is familiar or obvious? (the call to the config file is just for connecting to the db, it contains username, pw, etc.) I appreciate the time you spend on this, don't stress if it gets to be too much. ><? /*if (!ini_get("register_globals")){ foreach ($_REQUEST as $k=>$v){ if (!isset($GLOBALS[$k])){ ${$k}=$v; } } }*/ $productName = isset($_GET["productName"]) ? $_GET["productName"] : ""; $product = isset($_GET["product"]) ? $_GET["product"] : ""; $photo = isset($_GET["photo"]) ? $_GET["photo"] : ""; $c = isset($_GET["c"]) ? $_GET["c"] : ""; $sc = isset($_GET["sc"]) ? $_GET["sc"] : ""; $subCategoryName = isset($_GET["subCategoryName"]) ? $_GET["subCategoryName"] : ""; $cat = isset($_GET["cat"]) ? $_GET["cat"] : ""; $subcat = isset($_GET["subcat"]) ? $_GET["subcat"] : ""; $page = isset($_GET["page"]) ? $_GET["page"] : ""; $categoryname = isset($_GET["categoryname"]) ? $_GET["categoryname"] : ""; require("../config/config.php"); if(!($link = @mysql_connect ($hostType, $dbUser, $dbPassword))) echo "cannot connect to database" . mysql_error(); else { mysql_select_db ($dbName) or exit("cannot select" . mysql_error()); } if($cat && $subcat) { $catquery404 = mysql_query("SELECT * FROM category WHERE catID=$cat"); $cat404 = mysql_num_rows($catquery404); $subquery404 = mysql_query("SELECT * FROM subcat WHERE subID=$subcat"); $subcatTitle = mysql_fetch_array($subquery404); $subcatName404 = "products/"; $replaceChars404 = array(" ", "'", ":", "/", ",", "&", "---", "&", "--"); $subcatN404 = str_replace($replaceChars404, "-", $subcatTitle["subName"]); $subcatName404 .= str_replace($replaceChars404, "-", $subcatN404); //echo $subCategoryName."<br />"; //echo $subcatName404; if($subCategoryName != $subcatName404) { header("HTTP/1.1 404 Not Found"); exit; } $sub404 = mysql_num_rows($subquery404); if($cat404 == 0 || $sub404 == 0) { header("HTTP/1.1 404 Not Found"); exit; } } else if($product && $photo) { //echo $productName."<br>"; $productError = mysql_query("SELECT products.productID, products.catID, products.subID, information.pageDesc FROM products,information WHERE products.productID = $product AND information.productID = $product"); $productRow = mysql_num_rows($productError); $photoError = mysql_query("SELECT photoID FROM photo WHERE photoID = $photo"); $photoRow = mysql_num_rows($photoError); $productErrorRes = mysql_fetch_array($productError); $photoErrorRes = mysql_fetch_array($photoError); $productName404 = "products/"; $replaceChars404 = array(" ", "'", ":", "/", ",", "&", "---", "&", "--"); $productN404 = str_replace($replaceChars404, "-", $productErrorRes["pageDesc"]); $productName404 .= str_replace($replaceChars404, "-", $productN404); //$productName404 .= "_".$productErrorRes["productID"]; //."_".$photoErrorRes["photoID"]."_".$productErrorRes["catID"]."_".$productErrorRes["subID"]; //echo $productName404; if($productName != $productName404) { header("HTTP/1.1 404 Not Found"); exit; } if($productRow == 0 || $photoRow == 0) { header("HTTP/1.1 404 Not Found"); exit; } } else if($cat) { $catquery404 = mysql_query("SELECT * FROM category WHERE catID=$cat"); $catTitle = mysql_fetch_array($catquery404); $cat404 = mysql_num_rows($catquery404); $catName404 = "products/"; $replaceChars404 = array(" ", "'", ":", "/", ",", "&", "---", "&", "--"); $catN404 = str_replace($replaceChars404, "-", $catTitle["catName"]); $catName404 .= str_replace($replaceChars404, "-", $catN404); //echo $categoryname."<br />"; //echo $catName404; if($categoryname != $catName404) { header("HTTP/1.1 404 Not Found"); exit; } if($cat404 == 0) { header("HTTP/1.1 404 Not Found"); exit; } } ?> <? $navSelect = mysql_query("SELECT * FROM category ORDER BY catID"); ?> <? //META DESCRIPTION CONTENT if($product && $photo) { $metaQuery = mysql_query("SELECT pageDesc,metaDesc FROM information WHERE productID=$product"); $metaResult = mysql_fetch_array($metaQuery); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>
  12. Hi click, I appreciate you trying this out, you are correct in what I'd like to have happen. Do I have to keep the 301 redirect code? I tried with and without, and in different orders, but still can't seem to get it to work. Maybe it is because the pages are built in the htaccess file? Although I guess that shouldn't matter. Here is what I have now, but still getting the string on the end. (I tried removing the 301 redirect part, but then the page is just a 404 error page.) >AddType application/x-httpd-php .php .html AddType application/x-httpd-php .php .shtml Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_Host} ^****.com [NC] RewriteRule ^(.*)$ [url="http://www.****.com/$1"]http://www.****.com/$1[/url] [L,R=301] RewriteRule (.*)_(.*)_(.*)_(.*)_(.*)\.php$ /products/index.php?productName=$1&product=$2&photo=$3&C=$4&sc=$5 [L] RewriteRule (.*)_(.*)_(.*)_(.*)\.php$ /products/index.php?subCategoryName=$1&cat=$2&subcat=$3&page=$4 [L] RewriteRule (.*)_(.*)_(.*)\.php$ /products/index.php?subCategoryName=$1&cat=$2&subcat=$3 [L] RewriteRule (.*)_(.*)\.php$ /products/index.php?categoryname=$1&cat=$2 [L] RewriteRule ^products/Wall-Sconses_2_4.php /products/Wall-Sconces_2_4.php? [R=301,NC] redirect 301 /products/Wall-Sconses_2_4.php [url="http://www.****.com/products/Wall-Sconces_2_4.php"]http://www.****.com/products/Wall-Sconces_2_4.php[/url]
  13. Hi, I appreciate anyone that could offer advice on this, or even a link to someplace I could not find yet with more info. I'm using a friends custom gallery script, which currently has an htaccess file that looks like this: > AddType application/x-httpd-php .php .html AddType application/x-httpd-php .php .shtml Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_Host} ^****.com [NC] RewriteRule ^(.*)$ [url="http://www.****.com/$1"]http://www.****.com/$1[/url] [L,R=301] RewriteRule (.*)_(.*)_(.*)_(.*)_(.*)\.php$ /products/index.php?productName=$1&product=$2&photo=$3&C=$4&sc=$5 RewriteRule (.*)_(.*)_(.*)_(.*)\.php$ /products/index.php?subCategoryName=$1&cat=$2&subcat=$3&page=$4 RewriteRule (.*)_(.*)_(.*)\.php$ /products/index.php?subCategoryName=$1&cat=$2&subcat=$3 RewriteRule (.*)_(.*)\.php$ /products/index.php?categoryname=$1&cat=$2 I added a 301 redirect from an old page to a new page, but it doesn't seem to be working correctly. Here is the code I added to the top of the htaccess file for the 301 redirect. (sconses was spelled wrong, and the pages are created on fly via the code above... based on whatever the title of the product is in the database, I think) >redirect 301 /products/Wall-Sconses_2_4.php [url="http://www.****.com/products/Wall-Sconces_2_4.php"]http://www.****.com/products/Wall-Sconces_2_4.php[/url] Now when I go to the old page, it redirects incorrectly to this: >http://www.****.com/products/Wall-Sconces_2_4_1.php?subCategoryName=products/Wall-Sconses&cat=2&subcat=4 The above URL actually works in terms of the page not being broken, but it adds that unwanted second part. >?subCategoryName=products/Wall-Sconses&cat=2&subcat=4 The problem is since both URLs technically work, I didn't want to get hit for a duplicated content page. (There are multiple redirects/pages like this.) So basically, anyone know how I can get the redirect to stop adding that extra URL code? Any help is much appreciated. Thanks for your time.
  14. Possibly... I have this line above it: (my old site had an index.shtml page, but the new one is .php) >redirect 301 /index.shtml http://www.****.com/index.php and this below it, for image protection and redirecting the non-www domain: >Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_Host} ^****.com [NC] RewriteRule ^(.*)$ http://www.****.com/$1 [L,R=301] RewriteCond %{HTTP_REFERER} !^http://****.com/ [NC] RewriteCond %{HTTP_REFERER} !^http://****.com [NC] RewriteCond %{HTTP_REFERER} !^http://www.****.com/ [NC] RewriteCond %{HTTP_REFERER} !^http://www.****.com [NC] RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC] Sorry I shoulda posted this in the first place. (not sure if that bottom part is the most efficient way to redirect and image protect, i keep seeing many different ways and don't know what's best)
×
×
  • Create New...