How do I customize the shorten url that Bit.ly Pro creates? - bit.ly

With bit.ly I can create a shorten url than I can then customize:
http://www.myreallylongdomainname/reallylongpagename.html
becomes...
http://bit.ly/a8D83b
becomes
http://bit.ly/customtext
How do I do this with bit.ly pro api?

Related

Redirect url if Contains Query String to new URL and Pass Sting

I have a url https://example.com/registration-free/?member_id=1234&code=0e9236c500453e3c624ca96939f8aabf and this is a conformation link for a subscription process, but I want to locate this to another page and pass the variables, using regex in either htaccess or yoast pro for wordpress
the new page would be https://example.com/registration-step3/?member_id=1234&code=0e9236c500453e3c624ca96939f8aabf
But if someone goes to the page https://example.com/registration-free/ and there is no query string I don't want to redirect them.
Is this possible, so to clarify, if the initial page has no query string it doesn't redirect, but if a query string is present it redirects and passes the variables to the new url, using htacces or regex in wordpress yoast pro

Redirect url regex

I need to make some redirections in a wordpress site with "Redirections" plugin that allows only regex. Exactly i need to transform this url model:
http://example.com/cat1/subcat2/subcat3/subcat4/bar/this%20is%20page?start=130
To:
http://example.com/bar/this-is-page
Only if "bar" is in url. Anyway, last segment can be like this /page.
How can i obtain that result?

Django, external link url amended to project url

I have a Django project and want to take the user to an external link in openstreetmaps that is supplied lat and long from my Django model. In my view, I develop a url like this: "http://www.openstreetmap.org/?minlon=-92.024&minlat=57.5129102&maxlon=-91.52&maxlat=43.00&mlat=42.899&mlon=-91.774" and I provide it as a variable in my template. The link in my template is:
<a id="map" target="_blank" href={{mapurl}}>map</a>. {{mapurl}} is the url fed from my view.
The problem is that Django tries to find a url conf that looks like:
http://127.0.0.1:8000/beach/1825108/%22http://www.openstreetmap.org/?minlon=-92.0240039&minlat=42.78940921&maxlon=-91.5240039&maxlat=43.00940921&mlat=42.89940921&mlon=-91.7740039%22
rather than taking the user to the openstreetmap in a new page.
Any thoughts?
You can write the URL directly in the template
eg
<a id='map'
target='_blank'
href='http://www.openstreetmap.org/?minlon={{minLon}}&minlat={{minLat}}&maxlon={{maxLon}}&maxLat={{maxLat}}&mlon={{mLon}}&mlat={{mLat}}'
>Map</a>
You'd just have to pass the various variables in the template context

Mask forwarded blogger urls to own domain urls

Following Rounin's answer carefully written (thanks a lot) on how to redirect any blogspot urls with any extension to the mydomain.com corresponding URL, now the question is how can I mask the URL?
I mean, once the blogspot URL redirects to the mydomain.com, I want to continue to display the original blogspot URL instead of the mydomain.com.
You can use the following JavaScript snippet for that -
<script>
site = "http://example.com"; // The site which you want to mask, don't add ending slash
iFrame = document.createElement("iframe"); // Creates a iframe via JavaScript
iFrame.setAttribute("src", site + location.pathname); // Set the source of iFrame
iFrame.setAttribute("class", "maskingFrame"); // Add class to iFrame
document.body.appendChild(iFrame); // Append iframe to body of page
</script>
And the bare minimal CSS would be -
body {
overflow:hidden;
}
.maskingFrame, body {
width:100%;
height:100%;
border: none;
}
You can check a demo here (This is the homepage) and here (This is an internal URL from other site which doesn't exist on the original blogspot URL)
In privous answer you redirected page from blogspot to your domain. This causes the url to be changed. But if you want to show contents from another url without changing url it could be done through using .htaccess file.
the code in htaccess file should be like this:
RewriteCond %{HTTP_HOST} ^DomainA.com
RewriteRule ^(.*) http://DomainB.com/$1 [P]
Here you could find more details and info about .htaccess file.
I don't know if it is possible for you to place that file in your blog or not. If you have not access to place this file into your blog you can place it on your domain host, and redirect from your domain to your blogspot page but if ask me I recommend you redirect and encourage people to your own website rather than keeping them using weblog address. You'll not need weblog if you have your own website.

Django pagination - nice urls

I did pagination in my django projet. Everything works just perfect, but my urls looks terrible, like
host:8000/?page=1
How to create nice urls like
host:8000/page/2/ or host:8000/2/
I use standard Paginator class via ListView
How to do this w/o third party code ?
If you define url pattern like this:
url(r'^/page/(?P<page>\d+)/$', 'myapp.views.list_view'),
then ListView will pass page url keyword into paginator.
Notice:
Each path segment is supposed to be a valid resource, so it's not clear what you will display on /path/ URL.
Django pagination system assumes that webpages will default to using the URL query, so it's recommended to keep it as a URL query and it's more revealing.