Nginx rewrite rule - nginx

I need a rewrite rule for an nginx server. I'm using joomla 1.5 with sh404sef component to make clean urls.
Now i have installed gtranslate module to make the website multi language. So after installing the module my url's will change.
for example
My orginal url:
http://mywebsite.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=511&option=com_virtuemart
the sh404sef component will change this to
http://mywebsite.com/men-s/coverall-shirt-in-grey.html
But after installing gtraslate the urls changed like this
I want to replace a url to something different. for example:
http://mywebsite.com/index.php?/ja/page=shop.product_details&flypage=flypage.tpl&product_id=511&option=com_virtuemart
here i have enabled japanese language, so there is a additional string /ja/ added in the url.
This is making problems in the website.
I want a rewrite rule for nginx to replace this url to orginal one without ja
Does anyone have an idea.
Please help me..
--
Thanks in Advance
Tibin Mathew

if you rewrite the url in ngingx your joomla will never receive the /ja request, and consequently will never server the translated content.
you'll have to make the sh404sef component work with the gtranslate url's instead
http://gtranslate.net/forum/gtranslate-fully-compatible-with-sh404sef-t2168.html indicates this should be possible, but doesn't say how

Related

Trying to rewrite URLs for wordpress / nginx / WPML install

I have some wordpress experience, but it's my first time using Nginx. I have a WordPress installation running on Nginx. I added WPML (multi-language plugin) https://wpml.org/
The current URL structure is https://www.maindomain.com/blog/es/.... & https://www.maindomain.com/blog/en/.... etc. Everything works fine.
I'm looking for a way to rewrite the URLs in ninginx conf for the whole set-up to work with: https://www.maindomain/es/blog/.... instead of https://www.maindomain.com/blog/es/ and so on.
I tried several things and eventually i got stuck on:
rewrite ^/blog/en/(\w+\.?.*)$ /en/blog/$1 last;
which gives a 404 error on both URLs.
Any ideas on how to do this? Or is there a better way of doing this other than with rewrites?
...is there a better way of doing this
Possibly, yes. You can install WordPress in a root directory instead of a subdirectory (/blog) or point the domain to the subdirectory. This will give you URLs like maindomain.com
You can then set the Language URL setting in WPML to "Different languages in directories". This will give you URLs like maindomain.com/es/. Finally, you can create a page with the blog slug in WordPress (you should be able to set the same slug for the translation) and it will be accessible at maindomain.com/blog or maindomain.com/es/blog.

Wordpress network site URL handling

I have a szenario I don't know how to solve.
I have installed a MU Wordpress site.
First problem - site path
I have two sites "www.powerdoo.com" (site1) and "www.powerdoo.com/de-de" (site2).
But I want that my main site also has default path, so the result should be "www.powerdoo.com/en-us" (site1).
Inside the network "sites" settings it is not possible to change the path for the main site.
How can i solve this?
Second problem - web.config redirect
It my first problem is solved I now want the URLs Redirect like this:
www.powerdoo.com -> www.powerdoo.com/en-us
www.powerdoo.de -> www.powerdoo.com/de-de
Can anybody help me how I have to write a rule for this?
Thanks Steffen
In that case you need to map the domains to the respective wp sites and have rewritten the base url.
This plugin will help you out to achieve those redirects, is extremely easy to set up and also it will take care of the base url rewrites.
https://wordpress.org/plugins/wordpress-mu-domain-mapping/
This way your sites will work fine with both URLs (www.powerdoo.com -> www.powerdoo.com/en-us) and most probably you won't need to mess up the theme's code.
The only thing you need to be aware of is that "if it gets to happen"
that on some places of your theme the base url rewrite doesn't work it
will be most probably due to the way the original url is generated by
WP engine inside of the theme. But if you are php handy you will be
able to fix it on the theme or the child-theme with a
str_replace();.

Joomla/IIS7 url rewrite not showing Joomla Template

I have an issue where the URL re-write in IIS7 loads the component contents just fine, but not the site template.
Where this:
http://125valleywood.nexthometown.com/
Should look like this:
http://www.nexthometown.com/index.php?option=com_singleprop&view=singleprop&mlsnum=4200072
If I use "redirect" instead of "rewrite" everything is fine. I figure it has something to do with the domain joomla is tied to ?
My solution to this was to not use URL re-write. I instead mimicked a blind URL redirect using the DNS manager on windows server 2008. I figure it had something to do with the Joomla install not recognizing the subdomain. What I did not look into was seeing if Joomla would take a wildcard for the sitename, ie *.mysite.com. But since I never determined whether or not this was the problem in the first place, I not sure this would have been a solution.

Drupal 7 - rewrite all urls for a specifik page

I have a page (shop) in my drupal 7 site. On this page is a php script requesting a webservice.
The response depends on the URL, eg. /shop/pid-1234/pink-shoes.html will show a product with id 1234.
I therefore need Drupal to load the /shop page no matter what the URL after shop/ looks like. How do I
achive this? I have tried using wildcards in the URL alias module ($,%) but that didn't work. I have also
looked at pathauto and redirect, but didn't seem like they could help.
Any suggestions?
You probably need an Apache mod_rewrite rule. You can add something to your .htaccess file if you're using one.

How to rewrite part of the url with .htaccess?

I'm not that good with .htaccess, so I wonder, how can I rewrite default 'node' part of the url to an 'article' for example, so that server will output 'article/1' instead of 'node/1'. I need this to be done on a server side, so with the use of .htaccess only. Any guess?
The Pathauto module will allow you to set customised paths like this in Drupal. It's a must-have for Drupal (should be in Core, really). Just install and configure via the easy web-interface and you'll be all set.
You can even have different patterns for different node types. As an example, if you had 'page' and 'news' content types, your pages could have URLs like http://example.com/about-us while your news items could have urls like http://example.com/news/2009/05/28/news-post-title.
Well, the first problem is that you don't understand what mod_rewrite (which is what's doing the work you want, not .htaccess) does. It doesn't change the HTML you're outputting; it changes how the server interprets incoming URL requests.
So if your Drupal install understands node/1 and you want people to see article/1, first you need to modify the HTML output so it embeds links to article/1. Then you rewrite from article/1 to node/1 like so, in a .htaccess or Apache config file:
RewriteEngine on
RewriteRule article/ node/ [NS]

Resources