# Radiant in a subdirectory

**URL:** <https://www.ruby-forum.com/t/radiant-in-a-subdirectory/69221>\
**Category:** Radiant CMS\
**Created:** [September 19, 2006, 2:22pm UTC](https://www.ruby-forum.com/t/radiant-in-a-subdirectory/69221 "2006-09-19T14:22:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mislav](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/77aa72/32.png) [@mislav](https://www.ruby-forum.com/u/mislav)\
**Post date:** [September 19, 2006, 2:22pm UTC](https://www.ruby-forum.com/t/radiant-in-a-subdirectory/69221/1 "2006-09-19T14:22:43Z")

</div>

I have Radiant installed in a subdirectory, not the site root. I have  
set  
AbstractRequest.relative\_url\_root accordingly, which makes admin section  
work. Surprisingly, links generated by Radius tags on the site itself  
start  
from root ("/") and don’t get relative\_url\_root prepended to them… is  
having the application in a subdirectory unsupported? Did anybody have  
success setting it up like this?

I’ve searched the archives and the web but it seems there never was a  
discussion about not having the app in site root.

Thanks

---

<div class="post-metadata">

**Author:** ![mislav](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/77aa72/32.png) [@mislav](https://www.ruby-forum.com/u/mislav)\
**Post date:** [September 19, 2006, 2:34pm UTC](https://www.ruby-forum.com/t/radiant-in-a-subdirectory/69221/2 "2006-09-19T14:34:44Z")

</div>

Also make sure that you uncomment the line that starts “RewriteBase” in  
your  
public/.htaccess file and fill in the appropriate directory (if you’re  
using  
Apache).

Sean

---

<div class="post-metadata">

**Author:** ![mislav](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/77aa72/32.png) [@mislav](https://www.ruby-forum.com/u/mislav)\
**Post date:** [September 19, 2006, 3:12pm UTC](https://www.ruby-forum.com/t/radiant-in-a-subdirectory/69221/3 "2006-09-19T15:12:49Z")

</div>

On 19/09/06, Mislav MarohniÄ? [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have Radiant installed in a subdirectory, not the site root.

It would be great if you could document this on the wiki!

I’ve set up a link on the HowTo page and made the inital content:

[http://dev.radiantcms.org/radiant/wiki/HowToInstallInASubdirectory](http://dev.radiantcms.org/radiant/wiki/HowToInstallInASubdirectory)

–  
Regards,  
Dave

---

<div class="post-metadata">

**Author:** ![mislav](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/77aa72/32.png) [@mislav](https://www.ruby-forum.com/u/mislav)\
**Post date:** [September 19, 2006, 4:23pm UTC](https://www.ruby-forum.com/t/radiant-in-a-subdirectory/69221/4 "2006-09-19T16:23:06Z")

</div>

Mislav MarohniÄ? wrote:

> I have Radiant installed in a subdirectory, not the site root. I have set  
> AbstractRequest.relative\_url\_root accordingly, which makes admin section  
> work. Surprisingly, links generated by Radius tags on the site itself start  
> from root (“/”) and don’t get relative\_url\_root prepended to them… is  
> having the application in a subdirectory unsupported?

There’s no support for this out of the box, but you could create a  
behavior and assign it to the site root that would probably do what you  
need. Something like this:

class RootBehavior \< Behavior::Base

```
 register "Root"

 def page_url
   if parent_behavior?
     clean_url(parent_behavior.child_url(@page))
   else
     clean_url("/subfolder/#{@page.slug}")
   end
 end

```

end

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![mislav](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/77aa72/32.png) [@mislav](https://www.ruby-forum.com/u/mislav)\
**Post date:** [September 20, 2006, 3:45am UTC](https://www.ruby-forum.com/t/radiant-in-a-subdirectory/69221/5 "2006-09-20T03:45:38Z")

</div>

On Sep 19, 2006, at 11:22 PM, John W. Long wrote:

> There’s no support for this out of the box, but you could create a  
> behavior and assign it to the site root that would probably do what  
> you  
> need. Something like this:

Or if you want the really easy way out, you could create a parent  
page for your radiant root page and give it the same slug as the  
radiant directory.

eg for [http://my.site/cms](http://my.site/cms)

go from:

- Home (/home)  
|-- About (/home/about)  
…  
etc…

to:

- Subdir (/cms)  
|- Home (/cms/home)  
|-- About (/cms/home/about)

But I recommend John’s suggestion!

Bodhi

---

<div class="post-metadata">

**Author:** ![mislav](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/77aa72/32.png) [@mislav](https://www.ruby-forum.com/u/mislav)\
**Post date:** [September 20, 2006, 4:18pm UTC](https://www.ruby-forum.com/t/radiant-in-a-subdirectory/69221/6 "2006-09-20T16:18:53Z")

</div>

Bodhi wrote:

> Or if you want the really easy way out, you could create a parent  
> page for your radiant root page and give it the same slug as the  
> radiant directory.

Wow. That’s probably the easiest method by far. Out of curiosity Mislav,  
why do you want to put Radiant in another sub directory? Because of the  
way the rewrite rules are written, Radiant doesn’t serve content when a  
file already exists in the public directory. So if you wanted to put  
your own files in the public dir it would use those instead of relying  
on Radiant for the content. You could also change the rewrite rules so  
that Radiant only serves content from a certain subdirectory and the  
/admin/ folder.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)
