How do I make my dynamic URL's look Static

Discuss practical ways rearrange URLs using mod_rewrite.

How do I make my dynamic URL's look Static

Postby Deliriumxx » Mon Sep 08, 2008 8:39 am

Hello,,

I have a question about a situation I need resolved...
I am clueless about mode rewrite. I know how to implement pre-made code, but I don't know how to program it.

Any help is more then welcome.

Let me explain what I have....

I am dynamically creating links in my pages based on two parameters. Id, and Kw

There is only ONE file... index.php processing this,,, and for example,,, the urls in my page look like this one...


Code: Select all
http://mydomain.com/pages/index.php?id=4&kw=manufacturing-business-software


How would I be able to make all my urls appear like this in my page source:

Code: Select all
http://mydomain.com/pages/manufacturing-business-software.html


also,,, how do I make this URL appear in the address bar as a page,, instead of

Code: Select all
http://mydomain.com/pages/index.php?id=4&kw=manufacturing-business-software


I am sorry if I didn't explain this very well,,, I will explain better if you need me to make it clearer.

Thank you for all your help in advance.
Deliriumxx
 
Posts: 13
Joined: Fri May 12, 2006 8:34 pm

Postby richardk » Mon Sep 08, 2008 11:55 am

Do both id and kw change in the query string? If you want to remove the id (4) from the URL you need to read How to change a numeric ID into a name/title.

If you leave the id in the URL (eg. /pages/manufacturing-business-software-4.html) you can use (in a .htaccess file in /pages)
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^([^/]+)-([0-9]+)\.html$ /pages/index.php?kw=$1&id=$2 [QSA,L]


how do I make this URL appear in the address bar as a page

You have to edit he script to make it output those URLs. Have you asked the script author about a this?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Deliriumxx » Thu Feb 04, 2010 7:04 pm

A year + later :)

It is my script,, and it works.
Deliriumxx
 
Posts: 13
Joined: Fri May 12, 2006 8:34 pm


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 18 guests

cron