Hi. I’m on MODx 0.9.5, FreeBSD 6.0, Apache2 and adding ’NC’ to my .htaccess as per the comments in that file do not make my URLs non case-sensitive. What gives? Here’s the first several lines of my .htaccess:
AddType application/x-httpd-php .html .htm
# 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 /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
This is what happens when I use case that isn’t consistent with the page’s alias (ex: Home instead of home):
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« Too many forward attempts. »
SQL: The request could not be completed due to too many unsuccessful forward attempts.
[Copy SQL to ClipBoard]
Parser timing
MySQL: 0.0122 s (15 Requests)
PHP: 0.0164 s
Total: 0.0286 s
-
☆ A M B ☆
- 1,056 Posts
I hadn’t tested this recently myself, but when I pass a URL w/ UPPERCASE, etc I get sent to the defined 404 page. Granted, I am using SEO Strict URL plugin...
I would recommend, at a minimum, possibly trying the SEO Strict URL plugin (or disabling [NC] parameter?) to at least prevent multiple forwarding attempts/MODx error. Weird, hadn’t seen that one before...
Has anyone else been successful in getting case-insensitive Friendly URLs to work?
IMHO, I would not want mysite.com/Portofolio and mysite.com/portfolio to be treated the same. I’m thinking more SEO then I am user experience here, but personally I would prefer/Portoflio to be 301 redirected to /portfolio.
Update:
Whether I have "SEO Strict URLs" plugin active or not, or pass the [NC] parameter or not, I am always taken to my 404 page... (MODx v0.9.6)
-
☆ A M B ☆
- 1,056 Posts
Well done! I will test this now (in addition to SEO Strict URL, too)...
I assume that the [NC] parameter in .htaccess would STILL be required for handling of non-MODx served pages...
e.g. mydomain.com/CuStOm_ScRiPt.php
Update:
I copied the code (omitting <?php and ?>), checked off corresponding Plugin System Events...
However, I am still getting taken to my 404 page.
(I even disabled SEO Strict URL plugin...)
Hmmm...I will have to perform some troubleshooting to see what is/isn’t getting executed...
NOTES:
- I am using friendly alias paths, but you appear to account for that
OpenGeek:
Thanks for your help. I’m going to give the plugin a shot. Which system events should I have checked for this plugin? Thanks!
Nevermind that! I’m so stupid... Ok, so I’ve checked the OnWebPageInit and OnPageNotFound system events but still no dice. Is there anything else I should try? Thanks again.
Devin
-
☆ A M B ☆
- 1,056 Posts
Quote from: OpenGeek at Aug 24, 2007, 05:48 PM
just check the OnWebPageInit and OnPageNotFound events.
Oh, and the reason I was getting the redirect error was because I hadn’t setup an error page for 404s. Now I get sent to my 404 page.
-
MODX Staff
- 10,725 Posts
I’ve tested both with and without use_alias_paths here locally and seem to be having no problem getting it to work as I expect. I’ve also tried it with and without a friendly URL suffix. Do either of you have additional plugins attached to either of those events? If so, try re-sorting them so this one comes first in the execution order.
OpenGeek,
I don’t have any other plugins configured for those two system events. And I’m not using a prefix or suffix for friendly URLs.