Create a nice looking php link, is this possible ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Claudia007
Forum Newbie
Posts: 2
Joined: Wed Jan 11, 2006 9:44 am

Create a nice looking php link, is this possible ?

Post by Claudia007 »

I started recently with php.
I can create a small database BUT I have a question regarding the website-links.

For instance.
the website link for my webpage, created with php is

http://www.testclaudia.com/pictures.php?id=4

I want for example: http://www.testclaudia.com/4

Is this possible ?

IT WOULD BE GREAT.

Thanks for your help and assistance.
CLAUDIA>
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Neither of those links workl :?
User avatar
Nathaniel
Forum Contributor
Posts: 396
Joined: Wed Aug 31, 2005 5:58 pm
Location: Arkansas, USA

Post by Nathaniel »

They aren't supposed to, hawleyjr.

Create an .htaccess file in the folder pictures.php is in, and put this code in the .htaccess file:

Code: Select all

RewriteEngine On
RewriteRule ^([0-9]+)$ /pictures.php?id=$1
Unless your host has disabled htaccess files, that should work.
Claudia007
Forum Newbie
Posts: 2
Joined: Wed Jan 11, 2006 9:44 am

Post by Claudia007 »

Dear Nathaniel,

thanks for this code.
It would be great if it works. I will try it.

I will tell you.

Best regards,
Claudia.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

If it doesn't, you may have to enable to module for mod_rewrite (which is the name of what this is) in apache
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post by foobar »

Jcart wrote:If it doesn't, you may have to enable to module for mod_rewrite (which is the name of what this is) in apache
...in your httpd.conf file.
Post Reply