Ethic Solutions Free Webmaster Tools
     
Webmaster Discussion Forum -  Revenue Sharing Forum  webmaster talk related topic
Revenue Sharing Blog - Create your own
Create your own blog FREE and get 80% Revenue directly from google
Earn more revenue on our site, it's free!

» Free SEO Tools
» Check Page Rank
» Check Page Rank multi datacenter
» Check Fake Page Rank
» Alexa Traffic Rank
» Bulk Page rank Check
» Link Popularity
» Check domain Instantly
» Short url
» MD5 Encrypt
» Meta Tags Extractor
» Surf using Proxy
» Keyword Density Analyzer
» Keyword Analyzer
» Welcome to WMH
Registration at WebmastersHome is completely FREE and takes only a few seconds. By registering you'll gain:
  • Full Posting Privileges.
  • Access to Private Messaging.
Register now
Partner

Text Link Ads
Web Hosting
Flash Tutorials
PHP Scripts
Web Hosting providers
Offshore Software Outsourcing
Web Directory
Software Directory
Your Text Link
Earn More
Simply Add a Post and view ad network advertisement on this post.


Go Back   Webmaster Discussion Forum - Revenue Sharing Forum webmaster talk related topic > Design and Programming Talk > Apache Web Server


Search Engine Friendly URLs with PHP and Apache

Apache Web Server


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-02-2004, 07:16 AM
jhon jhon is offline
Junior Member
 
Join Date: Jun 2004
Posts: 3
jhon is off the scale
iTrader: (0)
Default Search Engine Friendly URLs with PHP and Apache

Hi friends,

Can any one help me make Search Engine Friendly URLs with PHP and Apache, actuly i want to convert the dynamic url to static

www.domainname.com/artical.php?ID=12

want to convert it in

www.domainname.com/artical/12

Please help to do this.

Thanks in advance

Jhon
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Revenue Sharing Ads ( Read More ):

  #2 (permalink)  
Old 06-02-2004, 07:33 AM
jitender's Avatar
jitender jitender is offline
Site Admin
 
Join Date: Jun 2004
Posts: 1,192
jitender has a spectacular aura aboutjitender has a spectacular aura aboutjitender has a spectacular aura about
iTrader: (0)
Default

Hi jhon

Welcome to this forum,

Please try below to convert dynamic url to static

Apache has a global variable called $PATH_INFO that is created on every HTTP request, What this variable contains is the script that's being called, and everything to the right of that information in the URL. $PATH_INFO will contain article.php/12.

First you have to split this into variables you can use. And you can do that using PHP’s explode function:

$var_array = explode("/",$PATH_INFO);

Once you do that, you’ll have the following information:

Code:
$var_array[0] = "article.php" $var_array[1] = 12

rename the variable you get $var_array[1] as $article

if your artical has multiple page you can also get the page value here

article.php/12/1 explode this

$var_array = explode("/",$PATH_INFO);

Code:
$var_array[0] = "article.php" $var_array[1] = 12 $var_array[2] = 1
$var_array[1] as $article and $var_array[2] as $page_num and get the value from database.


may be it will help you make dynamic url to static url

Regards
Jitender
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-03-2005, 06:58 PM
flashwebhost flashwebhost is offline
Junior Member
 
Join Date: Jun 2005
Posts: 8
flashwebhost is on a distinguished road
iTrader: (0)
Default

I think its better to use Mod-rewrite than using PHP $PATH_INFO, if you use path info, url will look like

article.php/12

You can rename article.php to article and get it work as php file, but have faced some problem when working with phpsuexe on.

You can use following .htaccess file.

Code:
RewriteEngine On RewriteRule ^/article/([0-9]*) /article.php?ID=$1
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-04-2005, 06:06 AM
jitender's Avatar
jitender jitender is offline
Site Admin
 
Join Date: Jun 2004
Posts: 1,192
jitender has a spectacular aura aboutjitender has a spectacular aura aboutjitender has a spectacular aura about
iTrader: (0)
Default

hi flashwebhost,


Yes it's realy better,

/article/1.html

looks cool also and more user friendly

Regards
Jitender
__________________
Free Webmaster Tools - Free SEO Tools
phpLDHacks - Add your template or Hack and earn money
Text Link Ads - Buy & Sell text link ads
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-15-2007, 03:55 PM
trigger55 trigger55 is offline
Junior Member
 
Join Date: Apr 2007
Posts: 16
trigger55 is on a distinguished road
iTrader: (0)
Default

Quote:
Originally Posted by jitender
Hi jhon

Welcome to this forum,

Please try below to convert dynamic url to static

Apache has a global variable called $PATH_INFO that is created on every HTTP request, What this variable contains is the script that's being called, and everything to the right of that information in the URL. $PATH_INFO will contain article.php/12.

First you have to split this into variables you can use. And you can do that using PHP’s explode function:

$var_array = explode("/",$PATH_INFO);

Once you do that, you’ll have the following information:

Code:
$var_array[0] = "article.php" $var_array[1] = 12

rename the variable you get $var_array[1] as $article

if your artical has multiple page you can also get the page value here

article.php/12/1 explode this

$var_array = explode("/",$PATH_INFO);

Code:
$var_array[0] = "article.php" $var_array[1] = 12 $var_array[2] = 1
$var_array[1] as $article and $var_array[2] as $page_num and get the value from database.


may be it will help you make dynamic url to static url

Regards
Jitender

good job ....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 04:13 PM.


Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0