: PHP URL Shortening/Re-Writing I'm looking to shorten some links, by re-directing. I'm wondering what the best way to do this is: I have files at www.mysite.com/qr/quicklinks/User/ but I'm wondering
I'm looking to shorten some links, by re-directing. I'm wondering what the best way to do this is: I have files at mysite.com/qr/quicklinks/User/ but I'm wondering if it's possible to somehow make it so it's just mysite.com/user? This would be brilliant if it can be done and possibly in PHP too? I've tried a few things but nothing seems to be working.
More posts by @Jessie594
2 Comments
Sorted by latest first Latest Oldest Best
You know you can just use Bit.ly for free and they have an api where your site can generate URLs.
Use a .htaccess file and mod_rewrite:
RewriteEngine on
RewriteBase /
RewriteRule ^qr/quicklinks/(.*)$ www.example.com/ [R=301,L]
Depending on the server, that's case-sensitive. Adjust the URL if necessary.
If that fails, try this PHP code:
<?php
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: www.site.com/Users/ );
?>
It won't support wildcard files though.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.