Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Php Mod Rewrite Tutorial, Simple tutorial
unLog!c
post Apr 13 2005, 06:38 PM
Post #1


Newbie
*

Group: Members
Posts: 2
Joined: 13-April 05
Member No.: 5,624



REQUIRED: Internet server (Apache 1.3.33 recomended), php, basic skills with .htaccess

Mod rewrite is cool Apache option, it helps you to make your site URLs simple and clean... also it is perfect for search engines...


This is mod rewrite, it replaces :
CODE
site.com/index.php?include=files?ID=45


with:
CODE
site.com/files/45


so lets get startet, open notepad, enter this in it:
CODE
RewriteEngine On // - you are starting rewrite mod :)
RewriteBase / // - you set the rewrite base
RewriteRule ^(.+)/([0-9]+)/?$ index.php?include=$1&ID=$2 // and rule:
// ^(.+) - text ONLY
// ([0-9]+) - numbers ONLY


DON'T INCLUDE MY COMMENTS IN REAL HTACCESS!!

CODE
RewriteEngine On
RewriteBase /
RewriteRule ^(.+)/([0-9]+)/?$ index.php?include=$1&ID=$2




save it as: .htaccess and upload it to the root directory...

and that's all work smile.gif

IMPORTANT:
there is problem with browsers, browsers don't recognize that folders you tiped are not real so there is problem with images and css style, so just include apsoluthe path
this is only basic, if you realy wanna do some serious work with mod rewrite visit:
http://httpd.apache.org/docs-2.0/misc/rewriteguide.html

as you can see this is also static URL, but can we be shure?! wink.gif



btw. sorry for not so great spelling wink.gif
Go to the top of the page
 
+Quote Post
iGuest
post Jul 4 2008, 05:16 AM
Post #2


Trap Double Mocha Member
***************

Group: Members
Posts: 2,360
Joined: 21-September 07
Member No.: 50,369



How to do this mod_rewrite tutorial
Php Mod Rewrite Tutorial

I am in the business of outsourcing. I have around 100 branded products for taking outsourced jobs. I have a list of the branded products keywords.

I have to design a page maybe in html or php whatever you may think fit with contents about outsourcing. Let us assume this is the below paragraph:-

"We are doing outsourcing for the product xxxx since last many years. We have all the resources to manage the outsourcing of the product xxxx. So if you have to outsource the requirement for xxxx, kindly contact us with the details"


Now if you take my product list in a text file of 100 product list. I want xxxx in the above paragraph to be replaced by the product keyword typed in search engine.

Now let us take for example I have product "H*P La*se*rjet 10*20" suppose if anybody type in the search engine the above keyword and if that keyword is in my list then the xxxx in the above paragraph in yellow should get replaced with the keyword "H*P La*se*rjet 10*20" and presented to the search engine. The output will look similar to the one given below

"We are doing outsourcing for the product H*P La*se*rjet 10*20 since last many years. We have all the resources to manage the outsourcing of the product H*P La*se*rjet 10*20. So if you have to outsource the requirement for H*P La*se*rjet 10*20, kindly contact us with the details"



Please help me know how to do it ? Any help from SEO Experts is highly appreciated.

Kind Regards

-reply by A.S.Pardeshi

ADMIN
================

You are basically talking about DYNAMIC content.

You will need a PHP engine which fetches WORDS out from database.

These words are replaced on the fly and the web-page is shown to your user.

MOD-REWRITE on the other hand can be used to GENERATE different pages. So, instead of writing 100 static pages, you can use MOD-rewrite to identify the requested page from URL and calling your PHP script with appropriate URL-encoded variables. :-)

This Page at Trap17.com uses MOD_REWRITE engine.

-Shree (Trap17.com)
Go to the top of the page
 
+Quote Post
optiplex
post Jul 15 2008, 09:44 AM
Post #3


Newbie [Level 2]
**

Group: [HOSTED]
Posts: 39
Joined: 26-June 08
Member No.: 64,213



dude, thats awesome!

This will make the url much cleaner ohmy.gif, with a simple .htaccess file and regular expression!
Now I know how those site do that ^^ And its funny

Thanks!
Go to the top of the page
 
+Quote Post
csp4.0
post Jul 15 2008, 12:53 PM
Post #4


NERVE: Interception
*********

Group: [HOSTED]
Posts: 553
Joined: 14-April 07
From: Holy Terra
Member No.: 41,610



QUOTE(unLog!c @ Apr 14 2005, 04:38 AM) *
REQUIRED: Internet server (Apache 1.3.33 recomended), php, basic skills with .htaccess

Mod rewrite is cool Apache option, it helps you to make your site URLs simple and clean... also it is perfect for search engines...


This is mod rewrite, it replaces :
CODE
site.com/index.php?include=files?ID=45


with:
CODE
site.com/files/45


so lets get startet, open notepad, enter this in it:
CODE
RewriteEngine On // - you are starting rewrite mod :)
RewriteBase / // - you set the rewrite base
RewriteRule ^(.+)/([0-9]+)/?$ index.php?include=$1&ID=$2 // and rule:
// ^(.+) - text ONLY
// ([0-9]+) - numbers ONLY


DON'T INCLUDE MY COMMENTS IN REAL HTACCESS!!

CODE
RewriteEngine On
RewriteBase /
RewriteRule ^(.+)/([0-9]+)/?$ index.php?include=$1&ID=$2




save it as: .htaccess and upload it to the root directory...

and that's all work

IMPORTANT: there is problem with browsers, browsers don't recognize that folders you tiped are not real so there is problem with images and css style, so just include apsoluthe path
this is only basic, if you realy wanna do some serious work with mod rewrite visit:
http://httpd.apache.org/docs-2.0/misc/rewriteguide.html

as you can see this is also static URL, but can we be shure?!



btw. sorry for not so great spelling



So... just to make this clearer, (I'm not really good at .htaccess and only know some basic commands) if I were to make this work for multiple files (i.e. if I were to use phpBB3, and wanted to change the "viewtopic.php", and "viewforum.php" ones to something cleaner I would change the code to something like this:?

CODE
RewriteEngine On
RewriteBase /
RewriteRule ^(.+)/([0-9]+)/?$ viewtopic.php?f=*
RewriteRule ^(.+)/([0-9]+)/?$ viewforum.php?f=*


Would that work? Does it even support wildcards? Or do I have to spend time installing a SEO modification?
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Php Simple Login Tutorial(63)
  2. How To Take A Screen Shot Of Your Desktop.(22)
  3. need a good and simple php-nuke tutorial(17)
  4. Msgbox(17)
  5. Simple Login In Visual Basic 6(6)
  6. How To Make A Very Simple Wap Site(40)
  7. Verifying Email Addresses(9)
  8. Simple Sig Tutorial(24)
  9. How To: Make A Simple Php Site(21)
  10. Simple C File Handling In Action(3)
  11. Watermark Your Image With Simple Php Script(35)
  12. What Is God?(52)
  13. Dialup Users Double Your Connection Speed(6)
  14. Pci Simple Communications Controller / Multimedia Audio Controller(5)
  15. A Simple Php Captcha - Image Validation(21)
  1. How Often Do You Use Css?(12)
  2. Simple Stylesheet Tutorial(2)
  3. A Simple Cms?(6)
  4. Simple Cms To Internet Marketing(2)
  5. A Simple Attack System(0)
  6. Simple Javascript And Password System(6)
  7. Verifying Your Email Address(0)
  8. Simple Is Beter - The Future Of Computers?(3)
  9. A Simple Preg_replace Help Please.(2)
  10. Making A Simple Signature With Adobe Photoshop(3)
  11. Finding Good Free Hosting Can Be Frustrating And Costly.(1)
  12. Create Dynamic Html/php Pages Using Simple Vb.net Code(1)
  13. Flash Tutorial Simple Motion Tween(0)


 



- Lo-Fi Version Time is now: 6th September 2008 - 07:58 PM