Forum

Thread tagged as: Problem, Runway

Runway rewrite issue in preproduction environment

Hi,

It seems that the rewrite rules doesn't work even though mod_rewrite is enabled on the server. I can access the perch admin though. The files are at the root /public_html (the domain points to https://domain.com/~web/). When I have the following rules in place in .htaccess, I get a page not found error.

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/~web/perch
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /~web/perch/core/runway/start.php [L]

When I have the following rule in place, it only shows me the directory of the /public_html files

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/~web/perch
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /~web/perch/core/runway/start.php [L]

I guess it's more of a server issue than perch issue but I wonder if you have any hints on this?

In config.php:

define('PERCH_LOGINPATH', '/~web/perch');
define("PERCH_DB_USERNAME", 'blabla');
define("PERCH_DB_PASSWORD", 'blabla');
define("PERCH_DB_SERVER", "localhost");
define("PERCH_DB_DATABASE", "web_perch");
define('PERCH_SITEPATH', '/public_html');

Here's the diagnostic:

PERCH INFORMATION

Perch Runway: 2.8.32
Production mode: Production (100)
Installed apps: content (2.8.32), assets (2.8.32), categories (2.8.32), collection_1 (2.8.32), collection_2 (2.8.32), perch_forms (1.8.3), collection_3 (2.8.32), perch_members (1.4), perch_podcasts (1.2)
DB driver: PDO
DB tables: perch2_backup_plans (0), perch2_backup_resources (0), perch2_backup_runs (0), perch2_categories (0), perch2_category_counts (0), perch2_category_sets (0), perch2_collection_index (908), perch2_collection_items (117), perch2_collection_revisions (25), perch2_collections (3), perch2_content_index (681), perch2_content_items (242), perch2_content_regions (93), perch2_forms (2), perch2_forms_responses (3), perch2_members (3), perch2_members_forms (0), perch2_members_member_tags (5), perch2_members_sessions (0), perch2_members_tags (11), perch2_navigation (1), perch2_navigation_pages (15), perch2_page_routes (17), perch2_page_templates (13), perch2_pages (64), perch2_podcasts (2), perch2_podcasts_downloads (7918), perch2_podcasts_episodes (5), perch2_resource_log (1021), perch2_resource_tags (0), perch2_resources (146), perch2_resources_to_tags (0), perch2_settings (20), perch2_user_passwords (0), perch2_user_privileges (37), perch2_user_role_privileges (40), perch2_user_roles (4), perch2_users (5)
Users: 5
App runtimes:
<?php
    $apps_list = array(
        'content', 
        'categories',
        'perch_members',
        'perch_forms',
        'perch_podcasts'
    );
Editor plug-ins: redactor, markitup
H1: 664ab770f399979a4050216777bd19fb
L1: 0617f3d9128331f263d55394cb6dd288
F1: 2edba60ed1f613d6dd804feb202456a2
headerColour: #000000
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.8.18: done
headerScheme: dark
update_runway_2.8.18: done
latest_version: 2.8.15
on_sale_version: 2.8.34
perch_members_update: 1.4
perch_members_login_page: /members/login.php?r={returnURL}
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 1
content_frontend_edit: 0
logoPath: /perch/resources/wef.png
update_runway_2.8.32: done
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_LOGINPATH: /~web/perch
PERCH_DB_USERNAME: web
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: web_perch
PERCH_SITEPATH: /public_html
PERCH_DB_PREFIX: perch2_
PERCH_EMAIL_FROM: ewwfe@geee.com
PERCH_EMAIL_FROM_NAME: ewfwwef
PERCH_PATH: /home/web/public_html/perch
PERCH_CORE: /home/web/public_html/perch/core
PERCH_RESFILEPATH: /home/web/public_html/perch/resources
PERCH_RESPATH: /~web/perch/resources
PERCH_HTML5: 1
PERCH_TZ: UTC
PERCH_RUNWAY: 1
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /home/web/public_html/perch/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SESSION_TIMEOUT_MINS: 20
HOSTING SETTINGS

PHP: 7.0.15
Zend: 3.0.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $
MySQL server: 5.5.5-10.0.29-MariaDB
Free disk space: 102.44 GB
Extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, pcntl, readline, Reflection, SPL, session, standard, cgi-fcgi, bcmath, bz2, calendar, ctype, curl, dba, dom, enchant, mbstring, fileinfo, ftp, gd, gettext, gmp, iconv, imap, intl, json, ldap, exif, mcrypt, mysqlnd, odbc, PDO, pgsql, Phar, posix, pspell, shmop, SimpleXML, snmp, soap, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlwriter, xsl, zip, mysqli, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, wddx, xmlreader, xmlrpc
GD: Yes
ImageMagick: No
PHP max upload size: 2M
PHP max form post size: 8M
PHP memory limit: 32M
Total max uploadable file size: 2M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
CONTEXT_DOCUMENT_ROOT: /home/web/public_html
CONTEXT_PREFIX: /~web
DOCUMENT_ROOT: /var/www/html
GATEWAY_INTERFACE: CGI/1.1
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8,fr;q=0.6
HTTP_CONNECTION: keep-alive
HTTP_COOKIE: timezone=Asia/Shanghai; cmsa=1; PHPSESSID=ljdn5725b155a5bclvsrus8l65
HTTP_HOST: v188069.serveradd.com
HTTP_REFERER: https://v188069.serveradd.com/~web/perch/core/settings/diagnostics/
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36
PATH: /bin:/usr/bin
QUERY_STRING: extended
REDIRECT_STATUS: 200
REMOTE_ADDR: 120.50.43.137
REMOTE_PORT: 51522
REQUEST_METHOD: GET
REQUEST_SCHEME: http
REQUEST_URI: /~web/perch/core/settings/diagnostics/?extended
SCRIPT_FILENAME: /home/web/public_html/perch/core/settings/diagnostics/index.php
SCRIPT_NAME: /~web/perch/core/settings/diagnostics/index.php
SCRIPT_URI: https://v188069.serveradd.com/~web/perch/core/settings/diagnostics/
SCRIPT_URL: /~web/perch/core/settings/diagnostics/
SERVER_ADDR: 103.11.188.69
SERVER_ADMIN: wefewf@efw.com
SERVER_NAME: v188069.serveradd.com
SERVER_PORT: 80
SERVER_PROTOCOL: HTTP/1.1
SERVER_SOFTWARE: Apache
UNIQUE_ID: WIrDjZIhtvs-Unc2@KG0aAAAAIY
PHP_SELF: /~web/perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1485489037.6623
REQUEST_TIME: 1485489037
argc: 1

Thanks.

Robin Pick

Robin Pick 5 points

  • 4 years ago
Duncan Revell

Duncan Revell 78 points
Registered Developer

It looks to me as if any web paths shouldn't have ~web in it, so remove it from your rewrite rules.

See if that helps.

Hi Duncan,

Thanks for chipping in. I have removed the /~web path from the rewrite rules. I can still login to Perch so I guess these weren't useful but I still can't see the pages. When I preview any page from Perch admin, it creates such url: https://domain.com/mypage and it throws 404.

Strange.

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you turn on debug, what does it output for that 404 page?

Duncan Revell

Duncan Revell 78 points
Registered Developer

I think some of your other paths are wrong - the login path should just be /perch and your site path should be /home/web/public_html

Hi Drew,

It's a generic 404 from host so it would go to debug. Could /~web create the problem with the routing? Is there anything special I should do in that context? What's strange is that if I browser without the /~web it brings me to "sorry, contact the host page".

Easiest may be to ask the host to allow me to write at the root?

Duncan Revell said:

I think some of your other paths are wrong - the login path should just be /perch and your site path should be /home/web/public_html

Hi Duncan,

For the login path, if I specify /perch, I can't login to Perch :/

Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to completely get rid of this ~web thing.

Duncan Revell

Duncan Revell 78 points
Registered Developer

It might be easier to install and start again...

As Drew says, the ~web is the issue.

For reference, ~web is a shortcut for /home/web - your current config has a mix of both. The file path to the root of your website is /home/web/public_html, the web path of the root of your website is just / and therefore the web path to the perch login should be /perch

Ok, thanks for the advices. I will get the hosts to remove that thing.

Cheers,

Duncan Revell

Duncan Revell 78 points
Registered Developer

I don't think the host needs to (the ~web shortcut/syntax is a built-in part of Linux) - it's the fact that (I'm guessing) during the Perch install, you typed it in as on elf the paths. Either edit your config files and remove any reference to ~web or go through the install process again and don't enter ~web anywhere....!

Duncan Revell said:

I don't think the host needs to (the ~web shortcut/syntax is a built-in part of Linux) - it's the fact that (I'm guessing) during the Perch install, you typed it in as on elf the paths. Either edit your config files and remove any reference to ~web or go through the install process again and don't enter ~web anywhere....!

Thanks Drew and Duncan. It's now fixed.

Duncan Revell

Duncan Revell 78 points
Registered Developer

Not a problem - I'm not sure what I meant by "typed it in as on elf the paths" up there, but it doesn't seem to have impeded you...!