Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-12-18 18:10:26

Registration errors
New Member
Registered: 2015-12-18
Posts: 4

Access Denied saving or copying templates

Noob question – I have checked documentation, forum, etc…

Using Presentation -> Pages (…textpattern/index.php?event=page), when I click Save or Copy I get served with the page …textpattern/index.php with only the text “Access Denied”. It will save plaintext OK but not anything with html.

This is a bit awkward if you are following the tutorial which suggests you replace the default template with “hello world” (which it allows) and then some html (not allowed). And of course you can’t restore the original template :-(

This was a default textpattern install using cPanel on 5quidhost.co.uk (->host39.qnop.net) and seems to work OK except for the above (mis)behaviour

Any suggestions?

Many thanks in advance.

Offline

#2 2015-12-18 19:22:26

kuopassa
Plugin Author
From: Porvoo, Finland
Registered: 2008-12-03
Posts: 229
Website

Re: Access Denied saving or copying templates

Some of my websites have had problems like that, except they occurred only if form/page had http:// in the content. Some security feature, I guess. :-/ I’ve asked several times from my hosting provider to fix the problem, and they’ve done so by adding some exception to firewall or something. But it’s sometimes still happening. Maybe my IP address changes at times and that explains it.

Offline

#3 2015-12-19 07:32:17

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: Access Denied saving or copying templates

Did you try adding one or both of the rules below

SecFilterEngine Off
SecFilterScanPOST Off

in your htaccess file?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#4 2015-12-19 10:48:33

Registration errors
New Member
Registered: 2015-12-18
Posts: 4

Re: Access Denied saving or copying templates

Thanks for the suggestion colak.

I have a file .htaccess-dist in my blog root directory (same level as textpattern directory) which contains only:

# $HeadURL: https://textpattern.googlecode.com/svn/releases/4.5.7/source/files/.htaccess-dist $
# $LastChangedRevision: 3501 $
# Inhibit directory listing
Options -Indexes
# Inhibit direct file downloads
RedirectMatch 403 .*

(except this markup seems to render the hash character as a numbered list – presumably the hashes comment out those lines?)

Is that the correct file?
Do I have to re-start Textpattern after modifying it?

The textpattern install is not on my local machine but on a shared server at a hosting company so not sure how I would restart it…

(apologies for my ignorance!)

Offline

#5 2015-12-19 11:59:47

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: Access Denied saving or copying templates

Hi,

That does not look like textpattern’s default htaccess file to me. Edit it and add

<IfModule mod_rewrite.c>
	RewriteEngine On
	#RewriteBase /relative/web/path/

	RewriteCond %{REQUEST_FILENAME} -f [OR]
	RewriteCond %{REQUEST_FILENAME} -d
	RewriteRule ^(.+) - [PT,L]

	RewriteCond %{REQUEST_URI} !=/favicon.ico
	RewriteRule ^(.*) index.php

	RewriteCond %{HTTP:Authorization}  !^$
	RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>

#php_value register_globals 0

# SVG
AddType image/svg+xml  svg svgz
AddEncoding gzip       svgz

<IfModule mod_security.c>
  SecFilterEngine Off
  SecFilterScanPOST Off
</IfModule>

Once done rename it to .htaccess by deleting the -dist part at the end of its name. You will not need to restart anything. Just check if everything works as it should.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#6 2015-12-19 14:04:49

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,596
Website

Re: Access Denied saving or copying templates

Registration errors wrote #297143:

Thanks for the suggestion colak.

I have a file .htaccess-dist in my blog root directory (same level as textpattern directory) which contains only:

# $HeadURL: https://textpattern.googlecode.com/svn/releases/4.5.7/source/files/.htaccess-dist $...

That file should be in the /files directory (=where textpattern saves file uploads) as the first line indicates, and not in your root directory. It’s an optional file that is distributed with textpattern for optional use if you want to forbid directory listing and direct downloads of the files in the /files directory.

The original .htaccess That Yiannis mentions begins with a dot and is therefore a hidden file. You may need to check a setting in your ftp program to show hidden files in order to see it.


TXP Builders – finely-crafted code, design and txp

Offline

#7 2015-12-24 21:51:48

Registration errors
New Member
Registered: 2015-12-18
Posts: 4

Re: Access Denied saving or copying templates

Re-checking, I see I have .htaccess in the blog root and .htaccess-dist in /blog root/files/
Renaming both as “was<old_filename” using the cPanel file manager has no effect: still “Access Denied”. Even after logging out/in.

This was a default install I have here. Anyone actually tried following the Textpattern tutorial (http://www.textpattern.net/wiki/index.php?title=Textpattern_Quickstart:_Hello_World#Go.21) and see if it allows you to save HTML?

Colak – I haven’t edited per your post as jakob says it is an optional file and I’m wary of typing in stuff I don’t understand (c/w just enter “format c:”, “y”). Hence renaming.

Offline

#8 2015-12-25 06:51:17

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: Access Denied saving or copying templates

Registration errors wrote #297186:

Colak – I haven’t edited per your post as jakob says it is an optional file and I’m wary of typing in stuff I don’t understand (c/w just enter “format c:”, “y”). Hence renaming.

jakob rightly said that the htaccess in the files directory is optional but the htaccess file in the root of your textpattern install is not, especially if you want to have clean urls. The four lines i proposed are some times needed for some hosts.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#9 2015-12-25 23:39:43

Registration errors
New Member
Registered: 2015-12-18
Posts: 4

Re: Access Denied saving or copying templates

Thanks very much for the explanation.
I added the four lines and the .htaccess file in the blog root now appears to read exactly as the listing above.
Still Access Denied :-(
It isn’t something like the “RewriteBase /relative/web/path/” should be an actual path or something else silly like that?

Last edited by Registration errors (2015-12-25 23:53:22)

Offline

#10 2015-12-26 07:26:24

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: Access Denied saving or copying templates

The RewriteBase path is normally commented out (using the #) but you can try uncommenting it and adding the path although I do not think that it will make any difference.

Do your diagnostics show any errors? You can check on Admin>Diagnostics.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB