473,659 Members | 3,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mod rewrite help needed

41 New Member
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 1371
dumm
10 New Member
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 New Member
@dumm
hi dumm

thanks. thats what i needed.

vineet
Dec 21 '08 #3
xNephilimx
213 Recognized Expert New Member
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 Recognized Expert Expert
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
1528
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 org.python.util.PythonInterpreter; import org.python.core.*; public class SimpleEmbedded { public static void main(String args) throws PyException {
1
1636
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 rewriting), but thought I'd ask... -Darrel
188
7171
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 - non-deterministic destructors - Objects can't exist on the stack - Type / Reference Types
1
2121
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 www.yoursite.com/products/ListProductsByCategory.aspx?CategoryID=1 will result in a partial missing of images and css which are packaged inside products folder. and if I rewrite from www.yoursite.com/products/beverages.aspx to
14
1812
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 decide whether they should rewrite their app in .NET. What are the trends being observed of Microsoft when it comes to .Net? How much longer will COM objects live on? How stable is the Framework?
0
3376
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
3492
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 (Vista Ultimate). I'm running my sites on IIS instead of the ASP.NET server. If I call my site using http://localhost in the browser, it works fine. However, as soon as I run it from within Visual Studio 2008 in
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8528
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2752
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.