Jump to content


Techniques for shortening URL with passed variables...


  • Please log in to reply
5 replies to this topic

#1 Guest_kilbad_*

Guest_kilbad_*
  • Guests

Posted 14 October 2006 - 03:52 PM

Question:: What techniques are avalible for shortening the overall URL length of an address with passed variables--other than shortening the variable name and its value?


The reason I ask is that I have coded a gallery script for myself, and the links are a bit long (for example:: http://kilbad.com/in...s&album=general).  I would like to make them shorter so I can more easily share them with family and friends.

I was just curious what other people with this problem have done.

Thanks so much in advance!
Brendan

#2 talreja_sapna

talreja_sapna
  • Members
  • PipPip
  • Member
  • 16 posts

Posted 14 October 2006 - 04:22 PM

i think u can try url redirection (mod_redirect)


#3 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 14 October 2006 - 04:43 PM

You could use mod_rewrite for Apache. You can take your URL, http://kilbad.com/in...s&album=general, and turn it into something like: http://kilbad.com/photos/general/

Here is a link to get you started with the basics.

http://www.yourhtmls...lrewriting.html

There are other resources on the right column of the page to get you further if needed.

Jeremy

#4 Guest_kilbad_*

Guest_kilbad_*
  • Guests

Posted 15 October 2006 - 01:55 PM

PERFECT!  Thank you so much..

however, here is a question, I am using the following code in my .htaccess, WITHOUT the [R]::

RewriteEngine on
RewriteRule ^photos/([^/\.]+)/?$ http://www.kilbad.com/index.php?id=photos&album=$1

However, it still redirects...  for example, if I type http://www.kilbad.com/photos, I get redirected to http://www.kilbad.co....php?id=photos¬† which shows up in the address bar..  how do I keep the second link hidden and keep the http://www.kilbad.com/photos in the address bar?

#5 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 15 October 2006 - 04:47 PM

Well the rewriterule you have does not match http://www.kilbad.com/photos

So you must have someother rewrite rule doing the redirect for photos

#6 Guest_kilbad_*

Guest_kilbad_*
  • Guests

Posted 15 October 2006 - 06:44 PM

you are absolutely right, that was not the full code...  here is my complete code..


RewriteEngine on
RewriteRule ^photos/([^/\.]+)/?$ http://www.kilbad.com/index.php?id=photos&album=$1
RewriteRule ^photos$ http://www.kilbad.com/index.php?id=photos
RewriteRule ^photos/$ http://www.kilbad.com/index.php?id=photos

..but I still have the same question.. how do I keep the, for example, "http://www.kilbad.com/photos" in the addressbar rather than the "http://www.kilbad.co...hp?id=photos"? 

Thanks so much for the help!
Brendan




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users