I realize that htaccess file use has been discussed extensively here and on other forums. So I’ve really tried to get
something to work but seem to have hit a wall. So here goes ...
I am working on putting a MODx site up to replace an existing non-MODx site on a different hos . The approach I took was to install MODx into the root and then to put a copy of the old site into a subdirectory. So I’ve got a directory structure that looks like this :
www.example.com/
sitefolder/
assets/
manager/
oldsite/
.htaccess
(... etc.)
Eventually a domain name will point to www.example.com/sitefolder.
In MODx, I set up a weblink that points to the folder "oldsite" and I have the offline page in the configuration
section pointing to this document. Then I set the site to be "offline."
Works fine (I think) except for two things :
- the site cannot be previewed by anyone unless they are logged into the backend
- anyone visting the www.example.com/sitefolder sees URLs that look like
www.example.com/sitefolder/oldsite/blah.html
What I’d like them to see is
www.example.com/sitefolder/blah.html
I don’t think there’s anything I can do about the first issue. But for the second one I figured that the correct settings in the .htaccess file would do the trick. Then when the site goes live, all I need to do is set it "online" and comment out the part of the htaccess file that does the rewriting.
Since I’m not a pro with the rewrite conditions, I tried to take a hint from this thread
http://www.webmasterworld.com/apache/3388596.htm
which suggested that this
RewriteEngine on
#
# Internally rewrite requests for all pages in "/" to pages in /main/
#
# If not already rewritten to /main/
RewriteCond $1 !^main/
# Prepend "/main" to the requested URL-path
RewriteRule (.*) /main/$1 [L]
should do the trick (if I replace "main" with "oldsite").
In a test, I can’t seem to get anywhere with this - it appears to be trying to find a location like www.example.com/oldsite/
No doubt the fact that I’m trying to work down a few folder levels isn’t helping me figure this out
Does anyone have any suggestions as to what might be off with the above code, in the context of MODx? It would
appear that folders inherit the .htaccess settings of parent folders - does anyone know of a reasonably simple way
of trying to figure out what if any rules are in effect or otherwise debug htaccess files?
Thanks in advance for everyone’s patience and any help.
Matt