Convert URL

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Chivalry
Forum Newbie
Posts: 2
Joined: Mon May 04, 2009 4:18 pm
Location: Menifee, CA

Convert URL

Post by Chivalry »

I don't know if a PHP forum is the best place to ask this, but I'm hoping that someone here will either know the answer or be able to point me to a better place.

What I want is fairly simply. If my web server is sent a request for a URL of the form http://domain.com/1234, I want this to be interpreted as http://domain.com/index.php?param=1234. Is this possible, and if so, any pointers on how to accomplish this would be gratefully accepted.

The server is Mac OS X Leopard, so the web server is Apache. The database server can be either MySQL or FileMaker, whichever works best.

Thanks,
Chuck
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: Convert URL

Post by jayshields »

You'll want to look around for rewrite rules. These are typically handled by .htaccess files in Apache. Either search on this forum or on Google and you'll be sure to find something.
ldougherty
Forum Contributor
Posts: 103
Joined: Sun May 03, 2009 11:39 am

Re: Convert URL

Post by ldougherty »

Try this; create a .htaccess in your web root with the following information:

Code: Select all

 
 
RewriteEngine on
RewriteRule ^1234$ /index.php?param=1234$1
 
 
Post Reply