Jump to content

Recommended Posts

Dear Talent

 

i have problem with mod rewrite when i seo url mode setting on then show page 404 not found. 

 

Here is code 

 

article.php


	include "init.php";
	
	// fetching setting info..
	$idx_res = query("SELECT * from {$prefix}settings");
	if(mysql_num_rows($idx_res)==0) 
		echo "no data";
	else
		$idx_row = fetch($idx_res);

	// increase number of views
	$art_id = intval("".($settings['set_seo_onoff'] == 'on' ? $art_id : $_GET['art_id'])."");


	if( $art_id <=0 )//!is_numeric($_GET['art_id'])) 
		die("<br><br><center><b>Please use a proper method to browse article(s) - The method you are using is not allowed...</b></center>");

	mysql_query("UPDATE {$prefix}articles SET art_views=art_views+1 WHERE art_id='$art_id'")
		or report("$art_id : ".mysql_error());


	/*
	---------------------------
	 get articles details here
	---------------------------
	*/
	
	$art_res=query("SELECT * FROM {$prefix}articles WHERE art_id='$art_id' and art_status='A'") or report();



	$rating = getRating($art_id);
	
	if(mysql_num_rows($art_res)==0) { 

			$redirect_msg = redirect_message("<b>Article not active / approved</b>","
			
			This may be becuase of one of the following reasons<br><br>
			<b>• Article may not be approved or still in pending list.<br>
			• Article may be deleted by one of the admin.<br>
			• Article being investigated by admin and temporarily unavailable.</b>
			
			<br><br>Please use the following links to proceed and perform certain actions.
			
			","<b>Quick options :</b> <a href='$root_path/manage_articles.php'>Manage your articles</a> . <a href='$root_path/myprofile.php'>Edit your profile</a> . <a href='$root_path/archives.php'>View archives</a>","$root_path/index.php",1);
			echo $redirect_msg;
			cdie();
	}
	
	else {
		$art_row=fetch($art_res);
		
		$art_url = $settings['set_seo_onoff'] =='on' 
			? "$root_path/article/".plaintext($art_row['art_title'])."-$art_row[art_id]-1.html"
			: "$root_path/articles.php?art_id=$art_row[art_id]&start=1";
		
		if($art_row['art_rss'] !='Y') {
			$tres = query("SELECT * FROM {$prefix}authors WHERE aut_id=$art_row[art_user_id]")
						or report("gaas:");
			$temparr = fetch($tres);
			
			$art_row = array_merge($art_row,$temparr);
			
		}
	}

	// article view - most recent articles in the category on/off

	if($settings['set_mrecent_articles_onoff'] == 'on')
		$most_recent_articles_row = most_recent_articles_in_category($art_row["art_cat_id"],$settings['set_mrecent_articles_num']);
	else
		$most_recent_articles_row = "";
		
	if($settings['set_mviewed_articles_onoff'] == 'on')
		$most_viewed_articles_row = most_viewed_articles_in_category($art_row["art_cat_id"],$settings['set_mviewed_articles_num']);
	else
		$most_viewed_articles_row = "";
	
	if($art_row["art_type"] == "L") 
		redirect("$art_row[art_url_link]");
				
	if($art_row['art_bbcode'] =='Y')
		$art_row['art_full_desc'] = bbcode($art_row['art_full_desc']);
		
	$art_row['art_full_desc'] = glossary_replace($art_row['art_full_desc']);		
	
	$art_date = date($date_format,$art_row["art_date"]);
	
	if($art_row['art_rss'] !='Y') 
		$art_row["aut_bio"] = bbcode(_html($art_row["aut_bio"] ));

	 /*
	 ------------------------
	  fetching category name
	 ------------------------
	 */
	
	$cat_res=query("select * from {$prefix}category WHERE cat_id=$art_row[art_cat_id]") or report();
	
	if(mysql_num_rows($cat_res)==0) die("cannot find category..");
	else {
		$cat_row=fetch($cat_res);
		$cat_url = $settings['set_seo_onoff'] =='on' 
			? "$root_path/category/".plaintext($cat_row['cat_name'])."-$cat_row[cat_id]-1.html"
			: "$root_path/category.php?cat_id=$cat_row[cat_id]";
		
	}
	
	$catname = changestr($cat_row['cat_name']);
		
	 /*
	 ------------------------------------------------
	  set index page title and meta description tag
	 ------------------------------------------------
	 */

	$title = "$art_row[art_title]";
	$desc = _html($art_row["art_short_desc"]);
	
	$parr = explode($art_row['art_html']=='Y' ? "[pagebreak]" : "[pagebreak]","$art_row[art_full_desc]");
	
	if($settings['set_seo_onoff']=='off') {
		$start=1;
		if(isset($_GET['start']))
			$start=$_GET['start'];
	} 
	$start--;
	
	$pages  = count($parr);

	$pgs= "";
	if($pages > 1) {
		$pgs= "Pages : ";
		for($i=1; $i<=$pages; $i++) {
			$pg = $i;
			if($start == $i-1)
				$pgs .= " [ <b>$pg</b> ]";
			else 
				$pgs .= $settings['set_seo_onoff']=='on' 
							? " <a href='$root_path/article/".plaintext($art_row['art_title'])."-$art_row[art_id]-$i.html'>$pg</a>"
							: " <a href='$root_path/articles.php?art_id=$art_row[art_id]&start=$i'>$pg</a>";
		}
	}
	$sscript = "

post-164826-0-18865800-1376663731_thumb.png

Link to comment
https://forums.phpfreaks.com/topic/281247-rewrite-code-of-php-page-not-found/
Share on other sites

@ Master sKunKbad

 

Bro this is my .htaccess rule

 

 

RewriteEngine On

RewriteRule ^([^/]*)/([^/]*)\.html$ /articles.php?art_id=$1&start=$2 [L]
 
Bro this is article publiser pro script ver 1.1 if u need i upload it or you can search on google & download easily. i am a student & doing mca & learning php . so i try to changes or modified this script for learning. i do some changes but in this script rss & rewrite  url not working . i try so much & google it but no success & i spend it more then 7 days after that decided to post.
 
regards & thanks
ravi
This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

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.