Issues with .htaccess file

Hi, my htacess. file is below, I don’t know what happened, but when I enter the main domain, I return Error 500, I should go to to go for the journal to load.

# @package    Joomla
# @copyright  Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
# @license    GNU General Public License version 2 or later; see LICENSE.txt

# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's.  If they work,
# it has been set by your server administrator and you do not need it set here.

## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

## Mod_rewrite in use.

RewriteEngine On

## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site block out the operations listed below
# This attempts to block the most common type of exploit `attempts` to Joomla!
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
## End - Rewrite rules to block out some common exploits.

## Begin - Custom redirects
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
## End - Custom redirects

# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root).

# RewriteBase /

## Begin - Joomla! core SEF Section.
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
php_value session.gc_maxlifetime 10800
php_value max_input_time         10800
php_value max_execution_time     10800
php_value upload_max_filesize    110M
php_value post_max_size          120M

## End - Joomla! core SEF Section.

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php72” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
# php -- END cPanel-generated handler, do not edit

# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (
<IfModule php7_module>

<IfModule lsapi_module>

END cPanel-generated php ini directives, do not edit
RewriteEngine on
RewriteCond %{THE_REQUEST} ^GET\ /ojs/
# RewriteCond %{HTTP_HOST} ^(www\.)?$
# RewriteRule ^ojs/(.*) /$1 [L,R=301]
# RewriteCond %{HTTP_HOST} ^(www\.)?$
# RewriteRule !^ojs/ ojs/%{REQUEST_URI} [L]
RewriteCond %{HTTP_HOST} ^$ [NC,OR]
RewriteCond %{HTTP_HOST} ^$
RewriteCond %{REQUEST_URI} !ojs\/
RewriteRule (.*) /ojs/$1 [L]

Could someone please help me?

Hi @sina,

I moved your post from the old thread here: Single journal url .htaccess configuration - #31 to a new post here. that was an older thread, so it is best to start a new one.

For the 500 errors, could you please have a look in your PHP error log and report on errors from there?

Could you also indicate the version of OJS you’re using (e.g. 3.3.0-13), in the future, please include this in your posts.

PKP Team

1 Like

Hi, thanks for the reply.

Previously Joomla was installed, so I think that’s why there are some Joomla tags on the htaccess file. It is no longer being used.

OJS version:

And currently my OJS is in a subfolder /ojs, which I preferably want to relocate it to the root (and not sure if just moving the files is enough).

The website is hosted on a shared server, and unfortunately, I don’t know where to find PHP errors.Here is the error_log:

[14-Mar-2021 05:19:04 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function PKP\Services\json_decode() in /home/denqgtqu/public_html/ojs/lib/pkp/classes/services/
Stack trace:
#0 /home/denqgtqu/public_html/ojs/lib/pkp/classes/site/ PKP\Services\PKPSchemaService->get('site')
#1 /home/denqgtqu/public_html/ojs/lib/pkp/classes/site/ SiteDAO->_fromRow(Array)
#2 /home/denqgtqu/public_html/ojs/lib/pkp/classes/core/ SiteDAO->getSite()
#3 /home/denqgtqu/public_html/ojs/classes/i18n/ PKPRequest->getSite()
#4 /home/denqgtqu/public_html/ojs/lib/pkp/classes/i18n/ AppLocale::getLocale()
#5 /home/denqgtqu/public_html/ojs/lib/pkp/classes/core/ PKPLocale::initialize(Object(Request))
#6 /home/denqgtqu/public_html/ojs/lib/pkp/classes/core/ Dispatcher->dispatch(Object(Request))
#7 /home/denqgtqu/public_html/ojs/index.php(68): PKPApplication->execute()
#8 {main}
  thrown in /home/denqgtqu/public_html/ojs/lib/pkp/classes/services/ on line 56

Please help me.

NB. There are two .htaccess files, one in the root and one in the /ojs subfolder. I don’t know which one to edit.

Hi @sina,

With OJS, we recommend having the .htaccess file in the web root directory:

As for the error log messages, I’m not sure about those, but I’ll see if another team member can weigh in (you can also try searching for those error messages here on the forum as well to see if they apply to your situation)

PKP Team