What would be the easiest way to shorten a URL with preg_replace? Let's say a URL looks like this:
http:/ /someurl.com/file_1/something_else/new/file_2.html
I want to reduce it to let's say 30 characters:
http:/ /someurl.com/file_1/some...
Thanks!
What would be the easiest way to shorten a URL with preg_replace? Let's say a URL looks like this:
http:/ /someurl.com/file_1/something_else/new/file_2.html
I want to reduce it to let's say 30 characters:
http:/ /someurl.com/file_1/some...
Thanks!
I think there's a little more to it if you still want the link to work
Have a look at this: https://github.com/briancray/PHP-URL-Shortener
Focus on Function Web Design
Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps
In that case, why not use substr() http://ca3.php.net/manual/en/function.substr.php
Focus on Function Web Design
Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps
Bookmarks