gotit Posted December 20, 2006 Share Posted December 20, 2006 I want to rewrite my dynamic URLs to static.this is the example that my host is giving:[color=red][font=Verdana]# Example for a rewrite rule:# (turns http://domain.com/xyz.html into http://domain.com/index.php?xyz)#RewriteEngine onRewriteBase /RewriteRule ^([a-z]+)\.html$ /index.php?$1 [R,L][/font][/color]This is the opposit of what I want to do.My urls read like this http://www.mydomain.com/system/listingView.php?listingCode=1053I would like to change the code above given as a sample by the host to rewrite this URL into static. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 20, 2006 Share Posted December 20, 2006 like this:http://www.mydomain.com/system/listing/1053If so then this should do:[code]RewriteRule ^system/listing/([0-9+])/$ /system/listingView.php?listingCode=$1[/code] Quote Link to comment Share on other sites More sharing options...
gotit Posted December 20, 2006 Author Share Posted December 20, 2006 Thanks,I loaded the file to system folder with this code.RewriteEngine onRewriteBase /RewriteRule ^system/listing/([0-9+])/$ /system/listingView.php?listingCode=$1But i still get errorI called the tech support and they say we do support mode rewrite, and the error looks like is from script and we don't provide script help.INTERNAL SERVER ERRORAn internal server error has occured!Please try again later. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 20, 2006 Share Posted December 20, 2006 Try that:[code]RewriteEngine onRewriteBase /RewriteRule ^system/listing/([0-9]+)$ /system/listingView.php?listingCode=$1[/code]Do you still get the internal server error? If you do check your servers error logs. It should be logged near the end of the log. Post it here. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted December 21, 2006 Share Posted December 21, 2006 A few hosts do not allow mod rewrite on shared hosting servers - They moan about some security but I don't think it's that much of an issue.Some will demand u have a dedicated server but personally I think this is all a bit un justified.They simply need to ensure AllOverride FileInfo is set on your directory in the apache config file which can be done easily and if they use anything like plesk then this can be set as default.Good luck finding a host that will allow you to use this wonderful tool. Quote Link to comment Share on other sites More sharing options...
gotit Posted December 21, 2006 Author Share Posted December 21, 2006 [color=red]I did upload the new code, still getting error bellow.[/color]Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator, webadmin@kundenserver.de and inform them of the time the error occurred, and anything you might have done that may have caused the error.More information about this error may be available in the server error log.Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the requestI spoke to hosting many times, they insist that they support mode rewrite and something wrong with my script. Quote Link to comment Share on other sites More sharing options...
gotit Posted December 21, 2006 Author Share Posted December 21, 2006 [quote author=wildteen88 link=topic=119322.msg489141#msg489141 date=1166646036]Try that:[code]RewriteEngine onRewriteBase /RewriteRule ^system/listing/([0-9]+)$ /system/listingView.php?listingCode=$1[/code]Do you still get the internal server error? If you do check your servers error logs. It should be logged near the end of the log. Post it here.[/quote]I got error again, see above post.74.96.71.69 - - [20/Dec/2006:23:07:36 -0500] "GET / HTTP/1.1" 500 - www.mywebsite.com "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" "-"74.96.71.69 - - [20/Dec/2006:23:07:39 -0500] "GET / HTTP/1.1" 500 - www.mywebsite.com "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" "-"74.96.71.69 - - [20/Dec/2006:23:07:45 -0500] "GET / HTTP/1.1" 500 - www.mywebsite.com "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" "-"66.249.66.163 - - [20/Dec/2006:23:10:01 -0500] "GET /system/proCategory.php?mainCategory=106&subCategory=108 HTTP/1.1" 500 - www.mywebsite.com "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" "-"66.94.237.181 - - [20/Dec/2006:23:10:44 -0500] "GET /tinc?key=VhV88EZb HTTP/1.0" 500 - mywebsite.com "-" "YahooFeedSeeker/2.0 (compatible; Mozilla 4.0; MSIE 5.5; http://publisher.yahoo.com/rssguide; users 0; views 0)" "209.131.37.237" Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 21, 2006 Share Posted December 21, 2006 Thats the access log. Access log doesn't log the errors but the requests to and from the server. There should be an error log somewhere. Quote Link to comment Share on other sites More sharing options...
gotit Posted December 22, 2006 Author Share Posted December 22, 2006 I found this in the Host web site:Creating own error logs for debugging php scripts.Since we dont provide access to Apache error logs on shared hosting packages for technical reasons, you can create your own error logs for debugging PHP Scripts.Please insert the following code in your PHP script (or create separate file and and add the code in it. Include the file using [b]"include()")[/b] [color=orange]<-------------------This i don't know wha it means !!![/color] error_reporting(0); $old_error_handler = set_error_handler("userErrorHandler"); function userErrorHandler ($errno, $errmsg, $filename, $linenum, $vars) { $time=date("d M Y H:i:s"); // Get the error type from the error number $errortype = array (1 => "Error", 2 => "Warning", 4 => "Parsing Error", 8 => "Notice", 16 => "Core Error", 32 => "Core Warning", 64 => "Compile Error", 128 => "Compile Warning", 256 => "User Error", 512 => "User Warning", 1024 => "User Notice"); $errlevel=$errortype[$errno]; //Write error to log file (CSV format) $errfile=fopen("errors.csv","a"); fputs($errfile,"\"$time\",\"$filename: $linenum\",\"($errlevel) $errmsg\"\r\n"); fclose($errfile); if($errno!=2 && $errno!=8) { //Terminate script if fatal errror die("A fatal error has occured. Script execution has been aborted"); } } Quote Link to comment Share on other sites More sharing options...
gotit Posted December 22, 2006 Author Share Posted December 22, 2006 I made this file and named it error log and loaded it in a folder: PHP file<html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body><?include("../system/.htaccess");?><?error_reporting(0); $old_error_handler = set_error_handler("userErrorHandler"); function userErrorHandler ($errno, $errmsg, $filename, $linenum, $vars) { $time=date("d M Y H:i:s"); // Get the error type from the error number $errortype = array (1 => "Error", 2 => "Warning", 4 => "Parsing Error", 8 => "Notice", 16 => "Core Error", 32 => "Core Warning", 64 => "Compile Error", 128 => "Compile Warning", 256 => "User Error", 512 => "User Warning", 1024 => "User Notice"); $errlevel=$errortype[$errno]; //Write error to log file (CSV format) $errfile=fopen("errors.csv","a"); fputs($errfile,"\"$time\",\"$filename: $linenum\",\"($errlevel) $errmsg\"\r\n"); fclose($errfile); if($errno!=2 && $errno!=8) { //Terminate script if fatal errror die("A fatal error has occured. Script execution has been aborted"); } }?></body></html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.