Redirect my website joomla - php

I want to redirect my website in differents languages when detect the country by (GeoIP), actually i have these urls and works well clicking on the flag images.
www.myweb.com/en www.myweb.com/es www.myweb.com/pt
But i dont know how to do it in joomla using the geoip.
I tried with .htacess and the answer of this question
how to redirect domain according to country IP address
and i have the error 500
SOLUTION:
Joomla provides a browser settings in system language plugin, just setting the joomla with this works perfectly!!

This extension does the job: http://extensions.joomla.org/extensions/style-a-design/templating/11173 Note that it's commercial. Your alternative would be download the GeoIP database (it's available for free), and then create a small plugin that does the redirection.
If you want, you can take a look at our post here: http://www.itoctopus.com/how-to-block-a-whole-country-on-your-joomla-website on how to block a country. You will only need to slightly modify the code to make it so that it redirects to another page for a certain country.

Try this,
Create a system plugin for Joomla
PHP functions available for checking visitors country use that identify the location.
redirect according to that.
Hope it helps..

Related

domain mapping in CakePHP

I'm trying to do domain mapping on my site in the fastest possible way so I've searched for PHP plugins that I can possibly use. However, all results are Wordpress-related. I'm using Cakephp 2.4. Is there an available plugin for this that is not WP? If not, how can I make use of the WP plugin to make it work in Cakephp?
[EDIT]
For example, if I have a public page on someonessite.com/myname and I want mysite.com/me to redirect or map the former site then I'll have to set something on someonessite.com so that mysite.com/me will display someonessite.com/myname via domain mapping.
[NEW EDIT]
So, I want to map mysite.com/me (my own site) to the IP address of someonessite.com/myname (someone else's site that I have account at and where I want to add this php code to)
eg.
I will save my own/customized site (mysite.com/me) at someonessite.com and let someonessite.com map my own site to their IP address to display someonessite.com/myname
You are not very clear on what you want, but at a guess it looks like you need this
You can use that plugin to set up different configs based on what domain is loaded. I use it for that use case also.
On mysite.com/me
use
<?php
/* Redirect browser */
header("Location: http://someonessite.com/myname");
exit;/* Make sure that code below does not get executed when we redirect. */
?>

Trying to incorporate members area from one site into another

I am working on a website where I need to use the login form to log into a different site and then bring the member's area from that site over to the one I am building.
I have access to both sites and can make changes on either one. I would incorporate the code from the old one directly but it is in ASP and I'm working with PHP.
Any ideas? The purpose would be for someone to login to the site through site A (no problem) then get the information from site B (no problem) and present it in site A (no problem if I use cURL to get the site and break it up then display it on the new one). The issue I get into is the links that are on the new site and gathered from the old site will still point to links on the old site. Maybe there is a way to dynamically generate those pages on the new site somehow? Or am I going about it all the wrong way?
It's essentially a proxy. You need to parse and rebuild the links in the html source code received from site B. There are no functions available for this, but there are numerous open-source proxy scripts you can take code from.
Glype should be open-source (site appears to be broken now unfortunately).
https://www.glype.com/
You need to split the links to change them depending on where do they point.
Links to css/js should be rewritten to point to the real url (note that ajax content won't work, because you can't do an ajax request to another website)
Absolute links to the real website should be changed to relative
Relative links should point at your website (ex. $new_url = '/viewpage/?page=' . urlencode($url);)
Absolute links to other domains (not the old website that you proxy) should be dealt somehow, think about what do you want to do with them exactly.

Changinging Joomla template according to the url open in the browser, how?

I am asking if is it possible do the following thing using Joomla
I have 2 different URL, something like: www.stupidname.com and www.seriousname.com
If the user open stupidname.com by his browser will open the website having a stupid template
If the user open seriusname.com by his browser will open the website having a serious template
The website and the content are the same...should only change the template according to the url open in the browser
Do you have some ideas about how to do this thing?
Thanks
Andrea
I've done this before making elements of a template conditional based on the domain name, and that can work well. I suppose you could extend the same logic to change the template.
Perhaps you could add a conditional to both template's index.php to change the template. Perhaps something like...
if ( substr_count( $_SERVER['HTTP_HOST'], "silly") ) {
$GLOBALS["mainframe"]->setTemplate = "silly_template_name";
} else {
$GLOBALS["mainframe"]->setTemplate = "serious_template_name";
}
...I've not tested this, but I think in principle it should work fine, though it might depend on which Joomla version you have.
There are, as saji89 pointed out, plenty of good multi-site extensions and that'd be an ok solution too.
From my personal experience with Joomla I can advise you to use the component Virtual Domains (http://extensions.joomla.org/extensions/core-enhancements/multiple-sites/7557) you can add the domains which you redirect to the main site where Joomla is installed and it this component you assign them the template you want.
I can confirm the functionality on Joomla 2.5 latest update with usage of around 5+ different Virtual Domains on one Joomla installation.
Some possible downsides i want to mention:
SEO links can get sometimes messy, you need to play with some SEO component and its settings
its better to use same structure and components for boths side its easier because otherwise the administration gets messy but its possible
the user which register on one website has automatically account on all of them because its one Joomla

How to make static Dynamic pages?

In MyBB forums you must have seen that all those threads are stoed as forum.com/Thread-Name-of-the-thread
So now this is static right ?
So now i have a site which has
blog.com/search.php?=SEARCHED+TEXT
So now how do i save this search so that Google can find out this page on my site ?
Indirectly what i mean to say is how i can i make
blog.com/SEARCHED+TEXT.html
"So now this is static right?" No. Just because the URL doesn't end in .php or similar doesn't mean it's static. It's time for you to learn the wonders of mod_rewrite:
http://www.workingwith.me.uk/articles/scripting/mod_rewrite
Your first example isn't static at all. It's just using a tool to route the request based on the URL.
All you need to get the same functionality is to investigate URL Routing in PHP and implement it in your application as well.
If you want Google to index this search page you have to tell Google it exists, either through a Sitemap or by putting a link on your site that Google can crawl. Google did fill in forms in the past, but I am not sure if they still do and afaik, they only did on a selected few sites.
To make the search static, you have to render the page once and store it in a file. Whether you do that manually by simply calling up the file in your browser and then saving it or by means of a Caching System is up to you.

How does mediawiki implement Special:Allpages?

We could access all pages of Mediawiki by url ./wiki/Special:Allpages.
But there is not php file that named Special:Allpages. How does mediawiki implement it?
Thanks.
For an indepth explanation see: http://www.mediawiki.org/wiki/Category:Wiki_page_URLs
However, here is a condensed version:
In Mediawiki the URL is not a link to a specific page like a simple web site. Instead it is a key that is used by the code to determine what page is displayed and to whom it is displayed.
Everything points to a single PHP page and that page directs the request to the actual page being called. So a call to SomePage may actually go to MyPage.php instead of SomePage.php
Based on how one sets up Mediawiki (or other modern PHP sites) this can be accomplished in many ways.
For Apache users one can use ModRewrite: http://www.mediawiki.org/wiki/Manual:Short_URL/Apache_Rewrite_rules
Or one can use URL Local Settings: http://www.mediawiki.org/wiki/Manual:Short_URL/LocalSettings.php

Categories