News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Question about .htaccess

Started by CokeCan, November 09, 2004, 03:06:21 PM

Previous topic - Next topic

CokeCan

I would like to know how to configure a .htaccess file
What I want to do is show a URL that looks like this www.site.com/file.php?id=45&country=ARG to something like this: www.site.com/file/45-ARG.html
Or something simillar, does anyone knows how to do it?
Thanks in advanced!

[Unknown]

RewriteRule ^file/(\d+)\-([^\.]+)\.html$ /file.php?id=$1&country=$2

-[Unknown]

CokeCan

Thanks Unknown! :D it isn't working but I will ask my server to check if Apache is correctly installed.
One more question how can I add one more variable to it next to the $country one?

[Unknown]

Just about the same way.  That was only a casual estimate though, it was completely untested and I believe you have to turn on mod_rewrite before it will work...

-[Unknown]

CokeCan

Is it ok if I put something like this?

RewriteRule ^file/(\d+)\-([^\.]+)\-([^\.]+)\.html$ /file.php?id=$1&ord=$2&country=$3

[Unknown]

RewriteRule ^file/(\d+)\-([^\-]+)\-([^\.]+)\.html$ /file.php?id=$1&ord=$2&country=$3

Or a little more simply but perhaps slower:

RewriteRule ^file/(\d+)\-(.+?)\-(.+?)\.html$ /file.php?id=$1&ord=$2&country=$3

-[Unknown]

Advertisement: