Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GS3.0 subdir and .htaccess
#1
Hi,

Firstly, finally im actually accepting a CMS as a method to manage content on our site (kudos ccagle8 for changing everything). GS was introduced via our svr admin (who is away on holiday and i doubt will be able to help with this issue so quick when he comes back).

GS is brilliant and everything has worked perfectly for us in the past and for me now during the upgrade though i am stumbling upon my first problem. I have just upgraded GS to 3.x (3.0 stable from 2.03) and thought i'd take the opportunity to move the installation out of the web root directory (.../public_html/) and into the 'cms' directory (.../public_html/cms) as the required subdir's QS needed shall i say was making a 'mess' of the otherwise 'organised' dir structure we have with other components of the site... hence wanting things a little more manageable by moving it into the '.../cms' dir.

As QS is the main component of the website, i've been trying to establish a way (via .htaccess) to have QS reside in .../cms with the "fancy url's" being accessible via the root dir ... eg "www.mydomain.com/contact-us". Naturally this works just fine when QS is installed into the root '/' but after installing it into '/cms' (even after a clean install) i cannot manage to stop the browser from displaying 'www.mydomain.com/cms/contact-us'.

Is there some magic i can place within a .htaccess file to do this? personally i am a Windows desktop app programmer and web/apache/server stuff is unfortunately a little outside my scope. I've been playing w/ it for quite a while now and am at a loss, so have resorted to the forums here to hopefully receive some help from one of the experts. It would be great if the resolution is a generic .htaccess mod (rather than a index.php solution in the root or manually doing RewriteCond/Rules in .htaccess for every 'slug'/page (hope thats the correct term))

Kind regards and thanks in advance!
Ben
Reply
#2
try with apache's mod_proxy, and just proxy the content from /cms to http:/www.domain.tld/
Addons: blue business theme, Online Visitors, Notepad
Reply
#3
yojoe Wrote:try with apache's mod_proxy, and just proxy the content from /cms to http:/www.domain.tld/

thanks yojoe for such a prompt response... its nearly 5am my time. i will give this a shot, not sure if our svr admin has installed this apache module. i will certainly reply again to ur help within 24hr (and make sure we get mod_proxy installed if its not already there). thank you very much for the suggestion! Smile

cheers!
Reply
#4
This isn't a superb solution, because it can be optimised a bit, but it should work on production systems, as it works on mine own:
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /cms/$1 [L]
Addons: blue business theme, Online Visitors, Notepad
Reply
#5
Hi,

I tried the mod_proxy method, though it seems we dont have it installed. Your next reply seems on the money though. I did try something like this before, though was just a few characters out from your suggestion and this made all the difference! Everything is working great (thanks!) as i intended except for requests against the root directory (eg http://www.mydomain.com/)

So i have tried various things such as adding conditions to the rule such as "RewriteCond %{REQUEST_FILENAME} =/ [OR]" and "RewriteCond %{REQUEST_FILENAME} =/index.php [OR]" or "RewriteCond %{REQUEST_URI} =/ [OR]" and several others (but maybe not all?), but still to no avail, cannot get the desired result of "www.mydomain.com/" actually going to "www.mydomain.com/cms/" (and not showing the .../cms bit). (ps. there is no index.php in the root to avoid any possible problem). I feel like the difficult bit has been passed and this is the "simple" last hurdle... but its got me still beat ;p

Might you (or anyone) have any suggestion? i would be most appreciative again.

Cheers & thanks again yojoe! Smile
Ben
Reply
#6
You know what's difficult ?
Giving a solution, without knowing all circumstances.
Try with:
Code:
RewriteCond %{REQUEST_URI} !/cms/$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /cms/$1 [L]
if you want to allow acces to any other content placed in root html directory.

ps. I'm not sure if I understood your problem well.
Addons: blue business theme, Online Visitors, Notepad
Reply
#7
Hi yojoe,

Sorry if i was a little too elaborate and unclear at the same time. I should have said that ur second suggestion (the RewriteCond's etc) was spot on. It solved 99% of the problem... it is near perfect, the only thing it left behind was rewriting rules for the root dir. Everything worked correctly... ie. www.mydomain.com/contact-us worked perfectly for the GS install when installed in a subdir (/cms/). The only problem was simply navigating to www.mydomain.com/ without specifying any particular page. The apache rules did not work for this and would return whatever it would by default in the root dir (a dir listing or index.php etc).

After a little f*cking about the solution has finally been found! (thanks entirely to ur assistance, otherwise i would have given up despite now in retrospect having been soooo close to the solution alone --- thanks!!!). I was looking at http://httpd.apache.org/docs/2.0/rewrite...veddocroot as some sort of guide though it didnt quite work out.

To clarify, what i simply wanted was to install GS into /cms/ yet make it appear to the browser/visitor that they were navigating the root dir. Ur suggestion was perfect except when navigating to the root dir (domain name alone - www.mydomain.com/ --- this would not show the front page).

The solution in the end was to add just one more RewriteCond which i was stupidly adding atop the list of RewriteConds which w/ Apache's ANR/OR logic was flawed. I simply moved the condition to the last line (w/ an 'OR' and everything is good now. This is an Apache related thing and nothing to do w/ GS, but the solution is now here in the GS forums

So for anyone reading this, here is what i ended up with ->

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond %{REQUEST_URI} =/
RewriteRule ^(.*)$ /cms/$1 [L]

Complete credit must go to yojoe! w/o his assistance i would not have worked this out (despite being so close). I hope this post helps other people out and avoids additional 'crap' in the forum.

Kudos to yojoe
Cheers,
Ben
Reply
#8
Ben,

great that it is working now!

Would you mind to add this to our WIKI? You are THE expert for this now ;=)

Cheers, Connie
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#9
Hi Connie,

Thanks for the compliments... certainly i will add this to the wiki w/ some more detailed instructions as i think this will aid more than just myself and avoid much unneeded posts in the forum.

Regards,
Ben
Reply




Users browsing this thread: 2 Guest(s)