[SOLVED] .htaccess problems

Post Reply
madhatter
Posts: 5
Joined: Tue Apr 11, 2017 11:14 am

[SOLVED] .htaccess problems

Post by madhatter »

Installed WonderCMS on my 1and1 hosting - and bang :( cannot get the URL rewriting to work at all - no admin panel, no nothing.

File permissions all checked and I've played around with the .htaccess file even adding various rewrite base options but nothing. Any ideas at all as to what I'm doing wrong?

URL: http://testing.taffmedia.co.uk

htaccess content:

Code: Select all

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /homepages/17/d539292587/htdocs/taffmedia/testing/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]

</IfModule>
prakai.na
Posts: 6
Joined: Tue Feb 21, 2017 8:43 am

Re: .htaccess problems

Post by prakai.na »

Same as me. On our system, We use 'AliasMatch' option to match URL to local directory (user's home directory), without modify 'DocumentRoot' option.

Code: Select all

AliasMatch ^/user/([a-zA-Z0-9\_\.]*)/?(.*) /home/user/$1/public_html/$2
I have modified 2 files to fix this problem.

index.php

Code: Select all

public static function url($location = '') {
        return 'http' . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']) . '/' . $location;
}
This function returns path based on URL not 'DocumentRoot'.

.htaccess

Code: Select all

Options -Indexes
ServerSignature Off
RewriteEngine on
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
RewriteRule ^.*$ - [E=CWD:%2]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ %{ENV:CWD}index.php?page=$1 [QSA,L]
RewriteRule database.js - [F]
Using url_rewrite without knowing RewriteBase.
ref: http://www.zeilenwechsel.de/it/articles ... eBase.html
madhatter
Posts: 5
Joined: Tue Apr 11, 2017 11:14 am

Re: .htaccess problems

Post by madhatter »

prakai.na you are a total star!

Thank you :) that's fixed and working perfect!!!! I've spent ages on this with no joy and then your fix sorts it in seconds.

Massive thank you. :D
prakai.na
Posts: 6
Joined: Tue Feb 21, 2017 8:43 am

Re: .htaccess problems

Post by prakai.na »

Your welcome. :D
User avatar
wiz
Admin
Posts: 569
Joined: Sat Oct 30, 2010 12:23 am

Re: .htaccess problems

Post by wiz »

Do you guys this solution would work for most WonderCMS users? As in an universal solution.

Aren't there any security downsides or downsides in general to using

Code: Select all

$_SERVER['SCRIPT_NAME']
?
Post Reply