How to Reorder Language Parameter In URL using URL Rewrite - ruby-on-rails

We have a Ruby On Rails application on parent folder and a Wordpress Multisite hosted in a subfolder named Blog. Hosting is provided by Azure and we are using IIS.
On the Ruby On Rails app an example url is below:
http://sitename.azurewebsites.net/{language-parameter}/card.html
Note that language parameter e.g. tr comes first.
Wordpress Multisite contains sites with each site has it's own url with language parameter only.
For example the Turkish site's homepage url is
https://wxtemp.azurewebsites.net/blog/tr/
and a sample post url is
http://sitename.azurewebsites.net/blog/tr/{post-slug}/
Notice that language parameter tr comes after /blog/ directory. Although we host Ruby on Rails app on / parent folder, can we customize its web.config file and add some kind of URL rewrite rule to handle changes, so browser address bar displays Wordpress links as
http://sitename.azurewebsites.net/tr/blog/{post-slug}/
and redirects visitors to this url if they are coming from:
http://sitename.azurewebsites.net/blog/tr/{post-slug}/
We want to have same approach for urls with language parameters of other languages we use as well. Parameters we use are de, es, fr, it, ms, ar etc... So I think what we need is a rule with a regex pattern.

Related

Kentico Library media file not available in MVC website

I'm creating a Kentico media library file using Kentico API 11.0.26. The CMS and MVC app are on a web farm. Both are in healthy state.
The file gets created fine, but is only accessible on the CMS application, not on the MVC website. This is true for both Direct Path link as well we Permanent link.
Copying/pasting the Permanent link in browser preceded with MVC domain gives this message: "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
Can someone explain what "same UNC root defined " means in this section:
If you are running the system on a web farm and have the same
UNC root defined on all servers, it is necessary to add the
following key into your web.config file. The files stored in the
libraries are then not transferred when synchronizing the web farm
content:
<add key="CMSWebFarmSynchronizeMediaFiles" value="false"/>
https://docs.kentico.com/k12/configuring-kentico/configuring-the-environment-for-content-editors/configuring-media-libraries
The UNC (Universal naming convention) is the standard for identifying a server/machine on a network, used like so: \\server-name\rest of path
In Kentico, you would be using UNC to tell Kentico where you're storing media library files if it's on a different server in the network.
The first thing that came to mind why you're getting a 404 is it's probably that the media URL has a tilde (~) preceding it. If that's the case, remove that tilde and see if the problem is resolved. Personally, I do a replace like so:
MediaLibraryHelper.GetPermanentUrl(mediaLibraryFile).Replace("~/", "/")
I'm not aware if there's a helper function to give you a URL without string replacing the tilde.

Joomla Site URL

I have a website on a 1and1 server. I have 2 domains on the package; the default url somenumbers.websitehome.co.uk and my actual URL.
The problem is, Joomla quotes the somoenumbers.websitehome.co.uk in system e-mails instead of my actual URL. They both point to the same directory I just don't want to give a stupid URL to my users.
I think I have narrowed it down to the $siteUrl variable but I'm not sure how to go from here.
Thanks
James
At first I thought this sounded largely like a DNS issue - but then you said you only have 1 Joomla installation and both domains point to that directory.
If they're both pointing to the same directory, then both domains will display the same Joomla installation. That is, unless you're checking to see where they are coming from and having the content display dynamically based upon how they got to your site - but from your comments I doubt you're doing that. How your domains are behaving is the expected response if you're pointing them both to the same directory.
If you want 2 sites on the same hosting? Setup 2 databases (or apply different prefix for each site and use 1 database) and set up each website in it's own directory.
Adjust the DNS of each domain name (and subdomain name) to point the appropriate directory.
From there, use the .htaccess file and SEF URL's to get rid of any indicator of the directory so that it displays the same as if the site was in the root directory.
That is the best way to accomplish what you're after - because from the sounds of it Joomla is doing exactly as it should, displaying correctly what is in the directory since both domain names point to the same directory.
$siteUrl should be left blank.

How to redirect dynamic URLs to a static url?

I am running my site on Apache Sever with Joomla CMS. I need to re-write a dynamic url to keyword rich url.
I am new to url re-writing, I have been trying to solve this, but unable to succeed in this. In the website, i have used the keyword rich url for navigation, but i found this url in yahoo.. Don't know from were this url is coming...
I have the url as www.example.com/keyword-rich-url.html, but other dynamic url is also being indexed by yahoo..
The dynamic url is www.example.com/index.php?option=com_content&view=category&layout=blog&id=61&Itemid=92
I want to re-write it to www.example.com/keyword-rich-url.html and redirect this dynamic url to the url which is used in the website itself, i.e http://www.example.com/keyword-rich-url.html
I tried this code
RewriteRule ^index.php?option=com_content&view=category&layout=blog&id=61&Itemid=92$ http://www.example.com/keyword-rich-url.html [R=301,L]
Any suggestions?
Before posting a question, do your own research and read Joomla documentation.
Check "Global configuration" section in Joomla Administration. There are options for SEO rewriting. Set them properly and make sure you rename htaccess.txt to .htaccess in the web root of your Joomla installation.

redirect domain to include local in url via apache or rails

I have many sites that run on a hosted rails 3 application on apache.
They can be multi-lingual and the domains are in this format www.example1.com/en , www.example2.com/de/pages/about-us , example3.hosted_sites.com/it/products/cars/hondas
The problem is that each domain has a www.example1.com domain as well that just uses the english local. This means that there is duplicate content on the 2 version ed www.example1.com and www.example1.com/en etc
What is the best way to add the /en into the requested url if a local is not specified ?
does anyone know a apache rule to do this ? i have many sites so its got to be generic / dynamic as cant look for a certain url in the url.
Or is this best done in my rails 3 app via a before filter ? anyone know how ?
Thanks alot
Rick
I have a similar scenario and use this plugin. It handles your translated routes with one default, eg
domain/someid --> english
domain/es/someid --> spanish
domain/de/someid --> german
https://github.com/raul/translate_routes

asp.net mvc routing, ignore route with extension in the middle of url

Hi How can make the asp.net routing engine ignore routes with an extension of the type
/pathtofile/filename.aspx/morepaths
I know this is hardly a real scenario but I need to know for another similar issue for an autogenerated url
Thanks
The MVC routing engine will not intercept a url if there is a matching file on the file system. (See RouteCollection.Ignore Method) So your example url will work fine. Query strings will also work fine.
You can test this out as follows:
Create an MVC application in Visual Studio
Run it
In your browser enter the url of the Site.css file in the Contents folder.
The file will be served and the browser will pop up the "Save" dialog.
Create an html file anywhere on the site and enter the url.
Your browser will display the html page.
Create an aspx web form anywhere on the site and enter the url.
Your browser will display the web form.
Add a query string or additional path to the url.
Your browser will display the web form.
You can also do this with .asp (classic ASP) pages (although the VS web server won't serve .asp pages, you have to set the site up in IIS for that to work.)
I hope that answers your question.

Resources