[EXTENSION] Redirect (forwarding to an external URL)

Post Reply
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

There was a discussion in Gitter about a plugin for redirecting. For example forwarding from a navgation entry for a page to an external page (URL).

I think where it is possible to do something without a plugin it's the better solution. Plugins always bloat a system, and can be a source of errors.

.htaccess

An easy and fast way is a redirect with .htaccess.

If you want for example forward the page "forward" to Google you can add the following to the file .htacces in the root direcctory of Bludit (between <IfModule mod_rewrite.c> and </IfModule>, below "RewriteEngine on"):

Code: Select all

Redirect /foward/ http://www.google.com/

JavaScript

You also can use a simple JavaScript snippet in the content field. For example:

Code: Select all

<script type="text/javascript">
    window.location = "http://www.google.com/";
</script>
This works without using an editor at all or SimpleMDE (not with TinyMCE). The forwarding is much slower than the redirect with .htaccess.
Last edited by Edi on Wed Dec 09, 2015 3:00 am, edited 1 time in total.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
diego
Site Admin
Posts: 773
Joined: Sat May 16, 2015 2:53 pm
Been thanked: 1 time
Contact:

Could you change the title of the post for:

[EXTENSION] Redirect (forwarding to an external URL)

It's for make an order on the category, thanks.
User avatar
diego
Site Admin
Posts: 773
Joined: Sat May 16, 2015 2:53 pm
Been thanked: 1 time
Contact:

You can also include the javascript code on TinyMCE, editing the source code, in the toolbar the icon is "< >".

Thanks for this Hack.
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

diego wrote:Could you change the title of the post for:

[EXTENSION] Redirect (forwarding to an external URL)

It's for make an order on the category, thanks.
Done.
Last edited by Edi on Wed Dec 09, 2015 3:04 am, edited 1 time in total.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

diego wrote:You can also include the javascript code on TinyMCE, editing the source code, in the toolbar the icon is "< >".
This does not (yet) work for me. Perhaps a configuration problem?
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
diego
Site Admin
Posts: 773
Joined: Sat May 16, 2015 2:53 pm
Been thanked: 1 time
Contact:

Edi wrote:
diego wrote:You can also include the javascript code on TinyMCE, editing the source code, in the toolbar the icon is "< >".
This does not (yet) work for me. Perhaps a configuration problem?
You are right, TinyMCE remove the tag script and others.
acrox999
Sr. Bludit
Posts: 30
Joined: Wed Jan 13, 2016 10:35 am
Location: /dev/null

Ah, why haven't I thought of this. Simply brilliant, but takes more time to do this than having an actual external links system or plugin. Hope it will get implemented soon.
Post Reply