Slashes in article/category alias may cause rewrite problem
Posted: Sun 30. Dec 2012, 13:48
				
				Hi,
Perhaps someone will find it interesting so when using slashes in article or category alias AND rewrite, at some point our backend may behave weird - ie ckeditor may not load showing 'page not found' message instead.
I don't know if it's a bug, I'd rather note it as a tip for all that didn't notice it, yet.
The solution for such is quite simple
In our site root .htacces file there is a line disabling rewriting the 'system' directories... yet it must be placed after all our conditional redirects and before final htm to php redirect... just like below
Let's say we have a redirect to cleanup non-full url of site.com/en or site.com/en/
and cleanup url for any other section, say.. site.com/section/ so it will show like this instead of section.html which is the native alias for it (yer all its children have slashed alias including section/ in front)
all such 'hard-coded' redirects or rules must be placed BEFORE we check-up on 'system folders' present in our url
after that we ensure in line 3, so if link points to system elements (ie ckeditor or directly to our uploaded files - rewrite will not touch it ([L] at the end means it's the last rule to apply in a queue)
and then, for all the rest that did not match the rule above - we carry on with rewrite 'play' to cheat the browser and use sweet and near url
cheers
...and happy new year
Adam
			Perhaps someone will find it interesting so when using slashes in article or category alias AND rewrite, at some point our backend may behave weird - ie ckeditor may not load showing 'page not found' message instead.
I don't know if it's a bug, I'd rather note it as a tip for all that didn't notice it, yet.
The solution for such is quite simple
In our site root .htacces file there is a line disabling rewriting the 'system' directories... yet it must be placed after all our conditional redirects and before final htm to php redirect... just like below
Code: Select all
RewriteRule ^en(/?)$ index.php?en
RewriteRule ^section(/?)$ index.php?section
RewriteRule ^(include|img|template|picture|filearchive|content)/ - [L]
RewriteRule ^(.+)\.html$ index.php?$1&%{QUERY_STRING}
and cleanup url for any other section, say.. site.com/section/ so it will show like this instead of section.html which is the native alias for it (yer all its children have slashed alias including section/ in front)
all such 'hard-coded' redirects or rules must be placed BEFORE we check-up on 'system folders' present in our url
after that we ensure in line 3, so if link points to system elements (ie ckeditor or directly to our uploaded files - rewrite will not touch it ([L] at the end means it's the last rule to apply in a queue)
and then, for all the rest that did not match the rule above - we carry on with rewrite 'play' to cheat the browser and use sweet and near url
cheers
...and happy new year

Adam