Forum Moderators: coopster

Message Too Old, No Replies

Shortening URLS

from /index.php?c=dz to /dz

         

Jeremy_H

1:36 am on May 13, 2006 (gmt 0)

10+ Year Member



I have an index page that gets variables passed along from the URL.

example.com/folder/index.php?c=dz

Since its the index page I can shorten that to:

example.com/folder/?c=dz

Is there a way to set it up so incoming links can be even shorter, something like:

example.com/folder/dz

And if possible, would it be advisable?

Thanks

eelixduppy

3:45 am on May 13, 2006 (gmt 0)



By using example.com/folder/dz you are saying that a directory, dz, exists and that you are accessing the index file of that directory. This does not make $_GET[c] equal 'dz'. I don't see why you would want to shorten it like this anyway. If you really don't want the?c=dz in there, you should look into other ways of getting the information to the next page. You could look into the $_POST [us2.php.net] superglobal and just make an input field on your form page hidden and submit the value of 'c' that way.

Good luck!

eelix

dreamcatcher

5:41 am on May 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



By using example.com/folder/dz you are saying that a directory, dz, exists and that you are accessing the index file of that directory.

Thats not strictly true eelixduppy. If you use mod_rewrite you can accomplish this. It makes for more search engine friendly URLs and can also be more secure as it masks the programming language.

Jeremy_H, if you are running an Apache server, try posting in the Apache forums:

[webmasterworld.com...]

dc

eelixduppy

5:46 am on May 13, 2006 (gmt 0)



Hmm...interesting. I'll have to look into that. Thanks

eelix

Jeremy_H

4:32 pm on May 13, 2006 (gmt 0)

10+ Year Member



Thanks, both of you,

I thought something like this could be done, but I thought it would be related to PHP since I'm changing the structure of the links to the PHP pages.

Sorry for posting in the wrong forum.

Thanks again!

coopster

4:33 pm on May 15, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Another option is to use Apache's Content Negotiation [httpd.apache.org].