Need a little bit of help, we've got a database setup with friendly URLs to do the output from the database - this all works fine, however i'm now having to add a physical subdirectory into the structure and basically its breaking and my htaccess
skills are nil.
Here's what I have for the virtual database URLS.
RewriteRule ^resources/([^/]*)/(.+)$ index.php?q=resources/$1-display/&req=$1/$2 [L]
This makes the url to appears as domain.com/resources/page/alias
page has a full alias of page-display hence the -display part.
Now, I want to move an existing page in the CMS
that was domain.com/alias
and move it to
domain.com/resources/subfolder/alias
The problem I have is as follows.
If I move the physical page to
domain.com/resources/[document] -
All works fine, it reads as
domain.com/resources/alias
If i move it to
domain.com/resources/subfolder/[document]
It explodes and throws a error
I've tried
RewriteRule ^resources/([^/]*)/(.+)$ index.php?q=resources/subfolder/$1/$2 [L]
and
RewriteRule ^resources/subfolder/(.+)$ index.php?q=resources/subfolder/$1/$2 [L]
RewriteRule ^resources/subfolder/(.+)$ index.php?q=resources/subfolder/$1/ [L]
But to no avail, anyone got any ideas as I'm not a expert in htaccess
by any means but I need to get this page up :/
Any help would be appreciated.
Many thanks
I'm not familiar with modx but think that your existing RewriteRule may be conflicting with the page at its new location.
If this is the case, you could get around it by adding a condition that makes an exception to the rule
RewriteCond %{REQUEST_URI} !^/resources/infographics
RewriteRule ^resources/([^/]*)/(.+)$ index.php?q=resources/$1-display/&req=$1/$2 [L]
This assumes that a request to /resources/infographics/this-is-the-page
would work fine after you've moved the page in the CMS and the existing rule is disabled.