|
Page 2 of 2
Overview | Tutorial 1, 2, 3, 4 | Usage Examples - Menus, Auto Redirection
Don't already own a copy of Geomla for Joomla! 1.5? Get it here...
Auto Redirection Example
Using the Geomla module to redirect users to different pages on your site depending on the country they're from
At present, when you create a Geomla menu item, it works great, but requires your visitor to click on the menu link before being taken to the correct article for their geo-targeted country. There might also be occassions where a visitor has come from a search engine and landed on the wrong page for their country, they would then have to know to click the correct menu item for the correct page. Not easily done.
What is sometimes needed is a failsafe method of automatically redirecting users if they land on the wrong page. This can be set up as follows:
Example In this example we already have a page in our Joomla! website that has information specifically for the United States, and a copy of it with more general information for the rest of the world. We want to make sure that if a visitor from the US lands on our rest of the world page, they are automatically redirected to the United States page and vice versa.
Step 1 - Create some custom HTML modules The first step is to create some custom HTML modules which will hold the javascript that deals with the redirection. Lets start with the US module. Go to Extensions->Module Manager and create a new custom HTML module. Give it a title (e.g. US Redirect), set show title to 'No', and set enabled to 'No'. Now add the following code as the custom output:
<script type="text/javascript"> <!-- var url = "http://www.example.com/USpage.html"; if(window.location != url) window.location = url; //--> </script>
Make sure the editor doesn't strip out this code - you may have to select 'no editor' in the site configuration for this to work. Repeat this for the rest of the world (or copy the module you just created), and call it something like 'ROW Redirect' and change the url in the javascript code to that of the correct page to redirect to (e.g. http://www.example.com/ROWpage.html).
Step 2 - Set up the Geomla component item Now go to Components->Geomla->Geomla Module Content and click 'New'. Give it a name (e.g. 'Page Redirect') and click 'select' next to 'Default Module'. (Note: Due to a minor bug you may have to click 'go' to display all the modules - this will be fixed in the next version) Select your 'ROW Redirect' module from the list (this is the module that will be targeted to the rest of the world). Now find the country you wish to target in the list of countries (in this case United States) and click 'select' next to it in the middle column. This time choose the 'US Redirect' module. Hit 'save'.
Step 3 - Create the Geomla Module Lastly, go to Extensions->Module Manager and create a new Geomla module. In the 'Select Geomla Module Content' parameter, select the Geomla Content you just created (e.g. Page Redirect). Give the module a name (e.g. Geomla Page Redirect) and set 'show title' to 'no' and 'enabled' to 'yes'. Place the Geomla module on both pages (the US page and the ROW page) using the 'menu assignment' list. It shouldn't matter what 'position' you give the module, but make sure it's one that will be rendered on your page and won't interfere with anything else. The nearer the module is to the top of the page's html code will make the redirection quicker. Note also, that if your pages are not currently assigned to a menu, then you obviously won't be able to assign the module to them. Make sure that the pages you are redirecting to are on a menu somewhere, even if it's hidden.
This should now work! Your user can land on either the US or ROW page, Geomla will display the correct javascript redirect for the users country, and if necessary redirect them to the correct page.
Again, we are hoping that the next version of Geomla will make this process a lot simpler, stay tuned ...
<< Start < Prev 1 2 Next > End >>
|
Comments
i did all the same as explained here in the steps
can you please explain where i must be missing
I'm sorry you are having problems.
I can't help you without knowing exactly what code you have in place and how you've set everything up.
Can you please contact support by using the support menu link at the top of this page with as much information about your problem as possible and a url link to the page you are trying to redirect.
Note: If you are using Geomla on a localhost setup, this might be causing the problem.
RSS feed for comments to this post.