-
☆ A M B ☆
- 350 Posts
This is a really weird issue that arose on a client's development site today. There is a document with the alias environmental-policy which when you try to view it goes to the error page. Site is being developed in Revo 2.2.7.
I tested on my own site with same alias and the same thing happens. And as that's a shared hosting environment, also checked on a Cloud development site and the same thing happens.
Strange bug?
Got round it by putting the company name before the word environmental.
Anyone else experienced this problem?
[ed. note: boomerang last edited this post 13 years, 6 months ago.]
Helen Warner
Number one pixel!
Proud to be linked with MODX at
Crimson Pixel
-
☆ A M B ☆
- 3,141 Posts
Works fine when I try it in my own installs. Are you using the View option to make sure you're looking at the right url? By default the url will be /environmental-policy.html and not just /environmental-policy in case you're trying that... is it published? Anything in the htaccess that might be conflicting?
-
☆ A M B ☆
- 350 Posts
Hi Mark - yes it is published and no its not the error page. And I retested on my Cloud installation and actually it was fine. So may need to look at bit more closely at my shared hosting. Although I do have another site which has the URL /environment.html which works fine.
Very odd... Will dig a bit further.
There are no error messages - other than the error page!
Helen Warner
Number one pixel!
Proud to be linked with MODX at
Crimson Pixel
-
☆ A M B ☆
- 350 Posts
This issue is arising on a multi-lingual site. Below is the .htaccess info. Anything here? Wondering if the 'en' at the start of environmental is causing some conflict with the reference to en|ar in .htaccess?
MODX supports Friendly URLs via this .htaccess file. You must serve web
# pages via Apache with mod_rewrite to use this functionality, and you must
# change the file name from ht.access to .htaccess.
#
# Make sure RewriteBase points to the directory where you installed MODX.
# E.g., "/modx" if your installation is in a "modx" subdirectory.
#
# You may choose to make your URLs non-case-sensitive by adding a NC directive
# to your rule: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
RewriteEngine On
RewriteBase /
# Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
#RewriteCond %{HTTP_HOST} .
#RewriteCond %{HTTP_HOST} !^example-domain-please-change\.com [NC]
#RewriteRule (.*) http://example-domain-please-change.com/$1 [R=301,L]
#
# or for the opposite domain.com -> www.domain.com use the following
# DO NOT USE BOTH
#
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.domainname\.co.uk [NC]
RewriteRule (.*) http://www.domainname.co.uk/$1 [R=301,L]
# Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
# https://www.domain.com when your cert only allows https://secure.domain.com
#RewriteCond %{SERVER_PORT} !^443
#RewriteRule (.*) https://example-domain-please-change.com/$1 [R=301,L]
# The Friendly URLs part
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
# The Friendly URLs part
# detect language when requesting the root (/)
RewriteCond %{HTTP:Accept-Language} !^(en|ar) [NC]
RewriteRule ^$ ar/ [R=301,L]
# redirect all requests to /ar/favicon.ico
# to /favicon.ico
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(en|ar)/favicon.ico$ favicon.ico [L,QSA]
# redirect all requests to /ar/folder* to /folder*
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(en|ar)/folder(.*)$ folder$2 [L,QSA]
# redirect all other requests to /ar/*
# to index.php and set the cultureKey parameter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(en|ar)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
# Make sure .htc files are served with the proper MIME type, which is critical
# for XP SP2. Un-comment if your host allows htaccess MIME type overrides.
AddType text/x-component .htc
# If your server is not already configured as such, the following directive
# should be uncommented in order to set PHP's register_globals option to OFF.
# This closes a major security hole that is abused by most XSS (cross-site
# scripting) attacks. For more information: http://php.net/register_globals
#
# To verify that this option has been set to OFF, open the Manager and choose
# Reports -> System Info and then click the phpinfo() link. Do a Find on Page
# for "register_globals". The Local Value should be OFF. If the Master Value
# is OFF then you do not need this directive here.
#
# IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS :
#
# Your server does not allow PHP directives to be set via .htaccess. In that
# case you must make this change in your php.ini file instead. If you are
# using a commercial web host, contact the administrators for assistance in
# doing this. Not all servers allow local php.ini files, and they should
# include all PHP configurations (not just this one), or you will effectively
# reset everything to PHP defaults. Consult www.php.net for more detailed
# information about setting PHP directives.
#php_flag register_globals Off
# For servers that support output compression, you should pick up a bit of
# speed by un-commenting the following lines.
#php_flag zlib.output_compression On
#php_value zlib.output_compression_level 5
# The following directives stop screen flicker in IE on CSS rollovers. If
# needed, un-comment the following rules. When they're in place, you may have
# to do a force-refresh in order to see changes in your designs.
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/png A2592000
BrowserMatch "MSIE" brokenvary=1
BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
BrowserMatch "Opera" !brokenvary
SetEnvIf brokenvary 1 force-no-vary
Anything?
Helen Warner
Number one pixel!
Proud to be linked with MODX at
Crimson Pixel
-
☆ A M B ☆
- 350 Posts
Quote from: garryn at Apr 12, 2013, 12:34 PMThis line looks to be the culprit to me - the extra question mark after (en|ar):
RewriteRule ^(en|ar)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
Tested and it didn't make any difference with or without that particular '?'
Could it be in the gateway plugin?
if($modx->context->get('key') != "mgr"){
/* grab the current langauge from the cultureKey request var */
switch ($_REQUEST['cultureKey']) {
case 'ar':
/* switch the context */
$modx->switchContext('arabic');
break;
default:
case 'en':
/* Set the default context here */
$modx->switchContext('web');
break;
}
/* unset GET var to avoid
* appending cultureKey=xy to URLs by other components */
unset($_GET['cultureKey']);
}
I have set up my context as per the screen grab.
Helen Warner
Number one pixel!
Proud to be linked with MODX at
Crimson Pixel
-
☆ A M B ☆
- 350 Posts
Ok Gary, I've tested your code and that works providing I change the base url to /en/ but I wasn't really after that.
I wanted to achieving something like you see on this site
http://www.mckinseychina.com/ although when you toggle between English and Chinese you can see the URL change from being /en/ to /zh/ but I would like the base to be mydomainname.co.uk without the /en/.
What am I missing?
Thank you for your help and feedback, it is appreciated.
Helen Warner
Number one pixel!
Proud to be linked with MODX at
Crimson Pixel
-
☆ A M B ☆
- 24,524 Posts
I use this gateway plugin (with the patch I added in the comments)
https://gist.github.com/gadamiak/3812853 What I really like about this is that there is no need for any rewrite rules, everything is handled in the plugin.
http://www.multilingual-modx.com/blog/2011/seo-friendly-multilingual-websites-with-modx-and-babel.html
-
☆ A M B ☆
- 350 Posts
Hi Susan, I've gone through the info you sent and followed the tutorial which was how I set things up originally, however, the LangRouter plugin doesn't appear to work as I can't toggle between the two languages - what am I missing? I've attached the setup for the two contexts.
I added your extra code to LangRouter and set the defaultLang (and saved property set - missed that initially

)and I've followed everything as per the set up but when I try to go from web context (/en/) to arabic context (/ar/) it just goes to error page?
It works to a point if I have the .htaccess file set up but I was under the impression this LangRouter worked without any changes to .htaccess - or have I missed something?
Thanks.
Helen Warner
Number one pixel!
Proud to be linked with MODX at
Crimson Pixel