473,320 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

mod rewrite help needed

41
hi all

i have a url like
description.php?id=$1
i used rewrite to make it seo friendly
RewriteRule ^product([^/\.]+)?.html$ description.php?id=$1
it gives me
product7.html
now i want to replace "product" word with dynamic word coming from database like Nokia N95 or LG Viewty

how can i do it.

what should i write in rewrite rule so that it accept dynamic word inplace of "product".

so that my url become
LG-viewty7.html

vineet
Dec 21 '08 #1
4 1356
dumm
10
Expand|Select|Wrap|Line Numbers
  1. RewriteRule ^.*([a-zA-Z\-]+)([0-9]+).html$ description.php?section=$1&id=$2 
  2.  
Where "section" become your dynamic word.
Dec 21 '08 #2
vinpkl
41
@dumm
hi dumm

thanks. thats what i needed.

vineet
Dec 21 '08 #3
xNephilimx
213 Expert 100+
dumm solution is right, but is really everything after your domain going to be a product? I reccomend you to do the following:

RewriteRule ^products/([a-zA-Z\-]+)([0-9]+).html$ description.php?section=$1&id=$2

So the rewritten url will look like products/LG-viewty7.html and you will have no problems if you want, say, add a contact page /contact.html.

Remember, that since a fake subfolder is added, all the relative urls (links, images, etc) should be passed to absolute urls, or else the browsers will try to look any relative url inside the products folder, that doesn't really exists.
Dec 24 '08 #4
pbmods
5,821 Expert 4TB
I like to do this because it's much more flexible:

Expand|Select|Wrap|Line Numbers
  1. # Virtualize anything that doesn't already exist.
  2. RewriteCond %{REQUEST_FILENAME} !-f
  3. RewriteCond %{REQUEST_FILENAME} !-d
  4. RewriteRule ^.*([a-zA-Z\-]+)([0-9]+).html$ description.php?section=$1&id=$2 
  5.  
Dec 24 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Link | last post by:
Hello!I am new to Python and I would like to rewrite the following code to python use to call by C program:// JPython code ======================================= import...
1
by: darrel | last post by:
We're using URL rewriting (Isapi Rewrite). Is there any way to grab the pre-rewritten URL or can you only grab the rewritten one? I'm assuming you can't (as that's sort of the point of URL...
188
by: christopher diggins | last post by:
I have posted a C# critique at http://www.heron-language.com/c-sharp-critique.html. To summarize I bring up the following issues : - unsafe code - attributes - garbage collection -...
1
by: baroque Chou | last post by:
Thanks for the help available on msdn, I have succesful done the rewrite job. But there are 2 problems arise: 1.when I try to rewrite the url from say: www.yoursite.com/beverages.aspx to...
14
by: Stan Canepa | last post by:
This post is mostly for discussion. Why rewrite in .NET? Just a general discussion not related to any specific details. I was just looking to see what reasons developers are looking to, to help...
0
by: 1978 | last post by:
Hey Guys I need some help. Firstly: Running Rails 2.0.x cPanel Version 11.16.0-RELEASE Shared hosting. My App is not in public_html/ but under home/usr/rails_apps/(rubyapp)
1
by: mazdotnet | last post by:
Hi all, I've installed the new Microsoft URL Rewrite Module for IIS 7.0 http://www.iis.net/downloads/default.aspx?tabid=34&i=1691&g=6 on both my laptop (Vista Home Premium) and my desktop...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.