I know it is possible to use mod rewrite in my htaccess
Take:
http://example.com/directory/perlscript.pl?base64encodedquery=jhfkjdshfsdf78fs8y7sd8
Make a shorter URL:
http://example.com/? whatever just want to make it prettier
Incoming: I am using use CGI;
thus $qry->param('base64encodedquery'));
Then I use use MIME::Base64
to decode the query string (encoded previously).
I don’t really need to encode and decode the query but, I am learning and just want to mask / hide my query string that contains up to 15 short parameters.
I am leaning towards a Perl module that shortens URLs and I am actively searching. I actually don’t think my encoded query can be used with mod rewrite. so I will also take module suggestions as well.
2
Answers
I’m not clear what you need to do, but if you just want to remove the path and query from a URL then you can use the
URI
moduleoutput
Since you’re intending to use generate the requests to your perl script using a HTML form at some point, that lends itself to a very simple solution. You can tell the browser to make a HTTP POST request instead of the usual HTTP GET request by adding a
method
attribute to the form tag like this.The browser will make the request to “http://example.com/directory/perlscript.pl“, but there won’t be a query string – instead the form data is passed in via STDIN. But you don’t really need to know that as whatever framework you’re using should transparently handle that and provide access to the passed in parameters exactly the same as if they were passed in via the URL.