Topic on Manual talk:Short URL

403 from changing .htaccess

4
Schiffy (talkcontribs)

So I started trying to make a wiki of my own, using a shared server (provided by doteasy). To start off, the only file named .htaccess was not in a similarly named directory, but in one called "/cache". I followed the ShortURL builder instructions, so my .htaccess file now looks like:

Deny from all
RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/index.php [L]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2 [L,QSA,B]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]

and has been placed in a new directory named "/.htaccess", and my LocalSettings.php file was also changed accordingly. Now, I am getting a 403 Forbidden with the following message: "You don't have permission to access /wiki/Main_Page on this server. Server unable to read htaccess file, denying access to be safe

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request."

Is there a simple fix for this without having to contact doteasy again?

Dantman (talkcontribs)

You're not supposed to edit the .htaccess in cache, that one is there to hide the contents of the cache folder from the internet. .htaccess is also not supposed to be a directory.

In most cases when setting up short urls there will be no pre-existing .htaccess file where you need it and you'll be creating a new one with the code you have as its contents (but without that `Deny from all` line).

Since your MediaWiki install is in the root, the .htaccess you are creating should be in the same directory as LocalSettings.php and index.php.

So you'll have:

/.htaccess
/LocalSettings.php
/index.php
...

All in the same directory.

Schiffy (talkcontribs)

Thanks for that. Never done this before, got a bit confused by the Manual page.

This post was hidden by 88.98.44.65 (history)
Reply to "403 from changing .htaccess"