Welcome to WebmasterWorld Guest from 54.147.134.218

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Create apache rewrite rule dynamically

     
2:18 am on Jun 21, 2014 (gmt 0)

New User

10+ Year Member

joined:Nov 29, 2003
posts: 5
votes: 0


Dear All

We want to use apache rule for dynamic / CMS based website

we want

myweb.com/myname001 to direct to myweb.com/abcd.php?id=100
myweb.com/myname002 to direct to myweb.com/abcd.php?id=200
myweb.com/myname003 to direct to myweb.com/abcd.php?id=300

All these entried are from table mtable in database

An user can add more records / entries to mtable how do i generate the apache rule in that case
6:25 am on June 21, 2014 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12711
votes: 244


How do you get from 001 to 100, 002 to 200 and so on? Will it always be a mirror-image reversal from one to the other? Or is there some other pattern?

It looks as if what you want is a simple capture and reuse. But before we go any further we need to figure out exactly what you're doing. You don't really want to redirect from a short-and-simple URL such as "myname001" to a longer and uglier URL such as "abcd.php?id=100" do you? I tend to suspect that what you really want to do is rewrite: when the URL says such-and-such, quietly serve content from somewhere else.