Jump to content

Runilo

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Runilo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for the reply I have tried using errorcodument in htaccess to redirect all requests to a 404 handler script. This worked fine, but all the pages had a 404 header. So basically, eventhough i had content to match the url, every single page would say not found in the header, and from what i understand, this is not a very good option when considering search engine indexing. I must admit that using errordocument instead of mod rewrite was a lot easier, but i'm really worried about all the pages showing a 404 header. I'm not sure if google will index such pages. If i use ErrorDocument 404 /handler.php in my htaccess file, and try to proccess the url's there to find the content, is it then possible to show the 404 header, only if no content was found?
  2. Hello By editing my .htaccess file, and enabling mod_rewrite, i have made it possible to use urls like this: http://www.example/funny-videos/ass-catches-on-fire and i can get the right content by exploding() the url. My .htaccess file: RewriteEngine On RewriteRule ^([^/]*)/([^/]*)$ /index.php?category=$1&trim=$2 [L] This thing works fine, but i'm a little worried about the search engines, because if a user misspells the address and no content matches the url, the user will still not get a 404 error. Basically, it is impossible right now to generate a 404 error on my website. From what i've heard, this is a bad think when considering search engine rankings. This could probably also generate a lot of dublicate content. On my website right now, i have 3 categories: funny-videos, funny-pictures and free-wallpapers. Is it in any way possible to use the rewrite rule, only if one of these categories is in the url, and if not, use errordocument? I tried using {QUERY_STRING}, but from what i can gather, this only works if the url has variables in it with ? and =. I've tried and tried, and spent days searching for information on this, but it seems that .htaccess information is lacking. Any help would be very much appreciated.
  3. Also, is this a safe method regarding google and other search engines?
  4. ok, thanks. So the problem is that i have a mysql query before sending the header?
  5. Hello I'm using mod_rewrite on a website that i'm developing, and i want a handler on my index file which redirects to a 404 header if the content is not found. I've written this code that's suposed to redirect to a 404 header, if the content is not found: Example URL: www.example.com/funny-videos/ass-catches-on-fire <?php include("db.php"); $url_request = $_SERVER['REQUEST_URI']; $url_array = explode ("/", $url_request); $category = $url_array[1]; $media = $url_array[2]; if (!empty($category)) { if ($category == "funny-videos") { $db = "filmar"; } else { if ($category == "funny-pictures") { $db = "myndir"; } else { if ($category == "free-wallpapers") { $db = "wallpapers"; } } } if ($db == "filmar" OR "myndir" OR "wallpapers") { $result = mysql_query("SELECT * FROM $db WHERE trim = '$media'") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { if (!$row['trim'] == $media) { header("HTTP/1.1 404 Not Found"); header("Location:". $_SERVER['REQUEST_URI']); exit(); } } } } include("config.php"); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> As you can see, the code checks a part of the url and matches it with a column in the database, and if the url does not match anything in the database, it's suposed to refresh the site with the same url, only this time with a 404 header, but it doesn't work. I don't get anny errors or anything, but i just don't get a 404 header no matter the url. Anyone know how to solve this?
  6. Thank you for the reply Well, using cookies just seems as the easiest way to go about it. I would like to ask a few more questions if that's alright. If i do not set an expiration time on the cookie, how long will it last?? The thing you mentioned about the database seems like a lot of work. I hope i'm not being too demanding, but would you care do explain a little bit on how do accomplish this?
  7. Hello. On my website i have this sms application which is beeing heavily used, so therefore i would like for the number of sent messages for each user to be 5 per day, and no more. When a user sends an sms, he is redirected to a page that confirms that the message has been sent. That page is called sms-ok.php. On this page i would like to have a cookie based counter. I have found this little script that does the counting: <html> <head> <title> PHP - Cookie Example 1 </title> </head> <body> <h1>Cookie Example 1</h1> <font size=+2 face = verdana> <? $visitcount = $HTTP_COOKIE_VARS["visits"]; if( $visitcount == "") $visitcount = 0; else $visitcount++; setcookie("visits",$visitcount); print "This is visit number " . $visitcount; ?> </font> </body> </html> Now, does anyone know how i can set the expiration time of this cookie to 24 hours? And how would i be able to display a message on another page, when the counter has reached 5? Any help is much appresiated
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.