I always seem to figure these things out /after/ I post a big long
question to the public.  But I did manage to fix it, and I'll write how
for future reference.

I'd noticed that there are a lot of problems when running on a
subdirectory (e.g. http://somesite.com/radiantroot/).  Setting
DocumentRoot in .htaccess partially addresses this, but still leads to
quite a few 404s, especially in generated links to stylesheets and
scripts, and the mailer.  This is because radiant or extensions will
generate links to, for example, http://somesite.com/css/stylesheet.css
when they should be linking to
http://somesite.com/radiantroot/css/stylesheet.css.

I have a partial solution that uses a few .htaccess lines.  You drop the
following in an .htaccess directory above the radiant root (the
public_html for somesite.com/):

RewriteEngine on
# if the link originates from the radiant directory,
RewriteCond %{HTTP_REFERER} ^.*somesite\.com.*
# rewrite the request, put a '/radiantroot/' before it
RewriteRule (.*)$ http://somesite.com/radiantroot/$1

You can generalize or specify this to taste, but the above code is what
worked for me.  It probably isn't recommended for public deployment, but
will work for testing on a subdirectory of a root domain.  Anyone who
has referers turned off (a feature when 'private browsing' is turned on)
will still not catch the links properly.  Also, make sure the .htaccess
has permissions set to 755.

If anyone thinks this is worth it, maybe we could drop this hint in the
wiki somewhere, or some other documentation.

thanks,
--danny

 

danny q. wrote:
> Hi Radiant list,
>
> I've been getting ready to migrate my current site to radiant, been
> running tests on a subdomain.  The last step before I switch over is to
> get a mailer contact form up and running, and I just can't seem to do it.
>
> I know that there've been a lot of updates in the past few weeks, and I
> think I can list my known unknowns as follows:
>
> 1.  Which mailer extension should I use for 0.6.7?  There's the svn
> listed in the radiantcms.org wiki, and there's another one in github. 
> Are either compatible and working with the current radiant?  I've tried
> both with no luck.
>
> 2.  Assuming one of them is compatible, can anyone give me some updates
> to the documentation?  I suspect the non-workingness may be more of a
> pebkac phenomenon, but I've spent a good amount of time hacking around,
> and can hardly even get a worthwhile error message (even though I
> enabled them in environment.rb).
>
> 3.  What changes should I have to make to get this working in a
> subdirectory of the URL root.  The radiant root url is on something like
> http://mysite.com/testing/, which has caused me a little trouble before,
> and might be the source of all my problems here.  Is there a site root
> variable I should change or define, or perhaps an .htaccess line I
> should drop somewhere?
>
> I'd really appreciate some pointers on this.  I've been really impressed
> with the community involvement and active development around here, and
> it's a big part of why I'm switching to Radiant.
>
> Thanks,
> --danny
>
> _______________________________________________
> Radiant mailing list
> Post:   Radiant@radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>   

_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to