Jump to content

Simple looking Urls


sudeepk

Recommended Posts

Hi, I have a application in which I embed about 2000 swf files. Named (1.swf, 2.swf.. so onn to 2000.swf). But, Iam embedding them from an external source. The url is quite ugly, huge , location and file name revealing.

 

Example of present url:

 

http://example.com/video.php?input=media/videos/1620.swf

 

I would like to have it smaller and less obvious..

Some what like..

 

http://example.com/video.php?id=1620

 

Or even fancier if you have any better ideas. :)

 

And I also need Facebook Like button enabled for each page separately. So was wondering if its possible to attach a facebook like button by attaching a current url into its script instead of making 2000 pages with script on each page.

 

Facebook like button code:

<iframe src="http://www.facebook.com/plugins/like.php?href=[Page url here]&layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>

 

It worked for me in a blog where I replaced the page url with current page tag. Can we do the same here in a single file?

Link to comment
https://forums.phpfreaks.com/topic/207807-simple-looking-urls/
Share on other sites

Well we will have to see more code...

 

For something like http://example.com/video.php?id=1620,

You could do something like this:

<?php
// for security measures
if (is_numeric($_GET['id']))
{$swf = $_GET['id'];
}
else
{$swf = "default";
}
// so if it was  http://example.com/video.php?id=1620 you would get (src='1620.swf')
// mind you this is just an example you'd have to replace the whole below echo
// statement with what ever you require
echo "<embed src='{$swf}.swf' />"; 
?>

 

You could get it even more prettier with something like example.com/videos/1620. Which will be more SEO friendly too. But for that you'd have to look into apache mod_rewrite. Somebody correct me if I'm wrong...

Link to comment
https://forums.phpfreaks.com/topic/207807-simple-looking-urls/#findComment-1086350
Share on other sites

@cs.punk

Thanks a lot. It really helped.

One last thing..

 

What to do if each file is named differently instead of numbers. Just tell in text(or which ever way is easy for you). The problem is solved for now. Just in case of further problems.

 

@dreamwest

I have no idea how to deal with it. Anyway thanks and I will learn more about it and implement it soon. :)

Link to comment
https://forums.phpfreaks.com/topic/207807-simple-looking-urls/#findComment-1086470
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.