Redirect by language

 know languages ​​"title =" saber idiomas "width =" 500 "height =" 348 "class =" aligncenter size-medium wp-image -5856 "srcset =" 500w, /saber-idiomas.jpeg 518w "sizes =" (max-width: 500px) 100vw, 500px "/> </a></p>
<p> Every time, in this globalized world, it is more frequent to find sites created in several languages, aimed at users of In my case I offer this functionality through a plugin, which generates the content of <a href= WordPress Help in various languages ​​in a structure of subfolders of type ' 'where ' language ' is the language code (eg: in for English, pt for Portuguese, and so on.

Well what would you think to redirect your readers directly to the version in your language of your website? . Well it is very simple, you do not have to install any plugin or modify your template, just have a folder structure for the different languages ​​in which your site is displayed. It is not even an exclusive WordPress trick

How do you get it with the redirection by language that you can add to your file '. Htaccess' and it's very easy. And this works because the browser of your readers always sends information to the server that visits, and one of these information is the language.

Just add a few lines like the following to your file '. Htaccess' ]:

In this example, in line 3 we say which language of the reader is redirected ( (en) ), and in the line 4 we note the route to which it will be redirected. You just have to adapt it to your needs.

Of course, you can add as many RewriteCond and RewriteRule as you need.

NOTICE : this publication is from two years ago or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say that we have not warned you.

Loading …

That may also help you:

Redirect via htaccess while updating

There are many plugins (well, just a couple of them) that allow you to create a temporary redirect page while making changes to your WordPress or you're just updating. The harsh reality ?, work inconsistently and there are already many cases in the WordPress forum that show problems when reloading the blog after an update.

Fortunately, with a bit of bravery and the file .htaccess we can do a temporary redirect to a special warning page while we update our site. It's as simple as using a code like this:

Taking a look at the code, what we do is say where the temporary page is, then we exclude an IP (the one you see is invented) so we can enter and check the status of our site, to finish we indicate the temporary redirection.

Of course, we have to create a temporary page, that is shown to our readers. Mine is no wonder but it works perfectly.

How to ban by IP or domain from htaccess

I already discussed the issue of restrict access in depth a few months ago, but I thought it would be interesting to have this information in particular because there are more and more situations in which we need to avoid any visitor, or RSS feed thief, access our site created with WordPress.

Edit the file .htaccess and add these lines, modified according to your need, logically:

IP xx.xx is what you have to modify. You can also add as many lines deny from as you need.

Of course, as before, replace domain_a_banear with the domain in question and you can add as many lines of type RewriteCond% {HTTP_REFERER} domain_a_banear .com [NC] as needed.
 banned "title =" banned "width =" 500 "height =" 500 "class =" aligncenter size-full wp- image-5492 "srcset =" 500w, 150x150.jpg 150w "sizes =" (max-width: 500px) 100vw, 500px "/> </a> </p>
<p> And with these simple tricks you can get rid of undesirables, give them a few inches of your nose. tell it in the comments, we will all be grateful. </p>
	</div><!-- .entry-content -->

	<footer class= modeerPosted on Categories Avanzado, Banear, htaccess, IP, Programación, RewriteCond, RewriteEngine, RewriteRule, Seguridad, Tutoriales / Trucos, WordPress.orgLeave a comment on How to ban by IP or domain from htaccess