dev,
yes you do understand the original issue. Apparently it’s quite a common occurrence as there are a number of apache blogs explaining how to rectify it.
It seems the mod_rewrite option is the favoured one.
the hyphen is preferred by SEO guns as it allows robots to read the url as a collection of words. Apparently the underscore means the url gets treated as one long word. (At least that’s my understanding or it.)
I wasn’t prepared to lose the admin functionality in the short term so i reverted back to the old file, and posted a few questions on some of the apache blogs to see if they could tell me where iwas going wrong.
As for the code: My original .htaccess file reads:
RewriteEngine On
RewriteBase /"mydomain name"/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /mydomainname/index.php?q=$1 [L,QSA]
And that all works ok.
The modified code reads:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /mydomain/
RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ /acwa/$1-$2-$3-$4-$5 [R=301,L]
RewriteRule ^([^_]*)_([^_]*)_(.*)$ /acwa/$1-$2-$3 [R=301,L]
RewriteRule ^([^_]*)_(.*)$ /mydomain/$1-$2 [R=301,L]
RewriteEngine On
RewriteBase /mydomain/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /mydomain/index.php?q=$1 [L,QSA]
As far as rewriting the underscores to hyphens it works.
However there are some side effects:
1: It mangles the design view in Quick Edit, although it’s fine in normal browsing.
2: In the backend TinyMCE disappears from the document editing pane.
3: Some of the sorting icons disappears from the left admin tree menu.
It’s not permanent, as if I revert back tot he old .htaccess file everything goes back to normal. [We do all remember to create backups of files before we mess with them don’t we?]
Anyway I’m guessing the global nature of the rewrite rule is affecting other parts of Modx.
Apparently the more specific you can make the rewrite rule the better. In this case specify what file type extension the rule should apply to.
As I said I’m no expert, any guns out there please feel free to point out the error of my ways.