Forum Moderators: coopster

Message Too Old, No Replies

Using htaccess to convert a specific folder into a querystring

         

Eric_Lander

10:28 pm on Jun 9, 2003 (gmt 0)

10+ Year Member



I've begun playing with PHP to the point that I want to have a profile page dedicated to about 250 products.

Since they'll all use the same template, I was hoping to make one php template from which the information is loaded through a query string...

So, I guess what I am looking for is some advice on how to make this:

_www.domain.com/script/123/

actually render out to browsing agents as:
_www.domain.com/script.php?id=123

-- I've had many bad experiences with query strings, so I'm looking to get rid of them in this site.

This is done through the .htaccess, is it not?

If so, any pointers or relative links that may help me?

Thanks all.

olwen

10:46 pm on Jun 9, 2003 (gmt 0)

10+ Year Member



I have a script called region (no extension)

In .htaccess I have
<Files region>
ForceType application/x-httpd-php
</Files>

My link looks like region/1 or region/1/4

The php parses the url, splits out the components and produces dynamic pages.

I learnt how to do it from the phpbuilder site.

For apache2 I had to include
acceptpathinfo on
in .htaccess.

Eric_Lander

11:28 pm on Jun 9, 2003 (gmt 0)

10+ Year Member



What would those changes have on the rest of the site?

grahamstewart

11:31 pm on Jun 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Alternative way to handle it is to use mod_rewrite.
But thats a BIG topic (do a few forum searches an you should find plenty of useful info).

Eric_Lander

11:35 pm on Jun 9, 2003 (gmt 0)

10+ Year Member



grahamstewart, I started on that the other day, both here and on the 'net, and quickly became overwhelmed. Guess thats the nature of the beast.

When I searched here on WebmasterWorld I came up with a lot of threads. Any in particular you are referring to?

Thanks!

jatar_k

11:42 pm on Jun 9, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



How about this to start
An Introduction to Redirecting URLs on an Apache Server [webmasterworld.com]

grifter

7:04 am on Jun 10, 2003 (gmt 0)

10+ Year Member



Eric, the time spent learning mod_rewrite will pay dividends. It's the #1 weird esoteric web tech voodoo witchcraft technique in my toolbox.