Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

Commit

Permalink
Notes regarding changes to .htaccess
Browse files Browse the repository at this point in the history
Fixes #1
  • Loading branch information
axllent committed Jan 20, 2016
1 parent 24cdaa2 commit 9d2f18d
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# SimpleMDE Editor & Markdown for SilverStripe 3
This module adds a field and a data type that allows for Markdown editing in the CMS, and HTML template rendering
using the Github Flavoured Markdown parser [Parsedown](http://parsedown.org/).
This module adds a field and a data type that allows for Markdown editing in the CMS, and HTML template rendering using the Github Flavoured Markdown parser [Parsedown](http://parsedown.org/).

It is integrated with the [SimpleMDE Markdown Editor](https://github.com/NextStepWebs/simplemde-markdown-editor)
for CMS editing (see "Editor limitations" below).
It is integrated with the [SimpleMDE Markdown Editor](https://github.com/NextStepWebs/simplemde-markdown-editor) for CMS editing (see "Editor limitations" below).

## Requirements
- SilverStripe 3.x
Expand Down Expand Up @@ -41,35 +39,30 @@ class MyMarkdownPage extends Page
```

### .htaccess:

The JavaScript and CSS resources needed to show the editor is unfortunately installed in the `vendor` folder. By
default, SilverStripe blocks all HTTP requests to it (note that we do not want to include the dependencies directly
because we want Composer to handle those dependencies). In order to get this to work, we'll need to allow access to
those resources.
The JavaScript and CSS resources needed to show the editor is unfortunately installed in the `vendor` folder. By default, SilverStripe blocks all HTTP requests to it (note that we do not want to include the dependencies directly because we want Composer to handle those dependencies). In order to get this to work, we'll need to allow access to those resources.

Add the following line:

```
RewriteCond %{REQUEST_FILENAME} !\.(js|css)$
RewriteCond %{REQUEST_FILENAME} !\.(js|css)$
```

above this line:

```
RewriteRule ^vendor(/|$) - [F,L,NC]
RewriteRule ^vendor(/|$) - [F,L,NC]
```
So that the `.htaccess` file would look similar to the following:

so that the `.htaccess` file would look similar to the following:

```
...
# Deny access to potentially sensitive files and folders
RewriteCond %{REQUEST_FILENAME} !\.(js|css)$
RewriteRule ^vendor(/|$) - [F,L,NC]
RewriteRule silverstripe-cache(/|$) - [F,L,NC]
RewriteRule composer\.(json|lock) - [F,L,NC]
...
# Deny access to potentially sensitive files and folders
RewriteCond %{REQUEST_FILENAME} !\.(js|css)$
RewriteRule ^vendor(/|$) - [F,L,NC]
RewriteRule silverstripe-cache(/|$) - [F,L,NC]
RewriteRule composer\.(json|lock) - [F,L,NC]
```

## Editor limitations:
SimpleMDE has some nice features such as full-page editing/preview, as well as "Side by Side" editing
[see demo](http://nextstepwebs.github.io/simplemde-markdown-editor/). Unfortunately this doesn't play nice with
SilverStripe's CMS as the fullscreen elements are positioned statically. Rather than some ugly hacking, and until
someone hopefully finds an elegant solution (pull requests please), fullscreen & side-by-side functionality has been
hidden from the toolbar.
SimpleMDE has some nice features such as full-page editing/preview, as well as "Side by Side" editing [see demo](http://nextstepwebs.github.io/simplemde-markdown-editor/). Unfortunately this doesn't play nice with SilverStripe's CMS as the fullscreen elements are positioned statically. Rather than some ugly hacking, and until someone hopefully finds an elegant solution (pull requests please), fullscreen & side-by-side functionality has been hidden from the toolbar.

0 comments on commit 9d2f18d

Please sign in to comment.