joomla site directs to not found object - joomla

I have a joomla site and I can enter the administration section.
But If I try to open the front end page:
http://localhost:8080/joomla6/ and hit enter it redirects to:
http://localhost:8080/joomla6/en/ and I get a message:
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.0.13
So how to reach the front-end page?
Thank you
This is the Index.php in the root folder:
<?php
/**
* #package Joomla.Site
*
* #copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* #license GNU General Public License version 2 or later; see LICENSE.txt
*/
/**
* Define the application's minimum supported PHP version as a constant so it can be referenced within the application.
*/
define('JOOMLA_MINIMUM_PHP', '5.3.10');
if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<'))
{
die('Your host needs to use PHP ' . JOOMLA_MINIMUM_PHP . ' or higher to run this version of Joomla!');
}
// Saves the start time and memory usage.
$startTime = microtime(1);
$startMem = memory_get_usage();
/**
* Constant that is checked in included files to prevent direct access.
* define() is used in the installation folder rather than "const" to not error for PHP 5.2 and lower
*/
define('_JEXEC', 1);
if (file_exists(__DIR__ . '/defines.php'))
{
include_once __DIR__ . '/defines.php';
}
if (!defined('_JDEFINES'))
{
define('JPATH_BASE', __DIR__);
require_once JPATH_BASE . '/includes/defines.php';
}
require_once JPATH_BASE . '/includes/framework.php';
// Set profiler start time and memory usage and mark afterLoad in the profiler.
JDEBUG ? JProfiler::getInstance('Application')->setStart($startTime, $startMem)->mark('afterLoad') : null;
// Instantiate the application.
$app = JFactory::getApplication('site');
// Execute the application.
$app->execute();
And this is the .htaccess file:
##
# #package Joomla
# #copyright Copyright (C) 2005 - 2012 Open Source Matters. All rights reserved.
# #license GNU General Public License version 2 or later; see LICENSE.txt
##
##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# 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.
#
RewriteEngine off
RewriteCond %{HTTP_HOST} !^www\.gitaarschoolvdgiessen\.nl
RewriteRule (.*) http://www.gitaarschoolvdgiessen.nl/$1 [R=301,L]
## 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 request is for something within the component folder,
# or for the site root, or for an extensionless URL, or the
# requested URL ends with one of the listed extensions
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
# 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]
#
## End - Joomla! core SEF Section.
See image.
and then I get this message:
Deze site is niet bereikbaar
De webpagina op http://localhost:8080/joomla/index.php?lang=en is mogelijk tijdelijk uitgeschakeld of permanent verplaatst naar een nieuw webadres.
ERR_CONTENT_DECODING_FAILED
if I go to: http://localhost:8080/joomla/index.php?lang=en

Related

Domain name in url multiple times

Domain names show up thrice after malware removal. I disable SEF in the configuration.php and this reduced the domain name to twice in URL. But the URLs are messed up. But links are still showing twice and menu items are showing thrice.
eg example.com/example.com/example.com/index.php/about-us
Of course, this stops images from showing up and somehow links (even though wrong) are still loading the text content from the supposed pages, without images of course - this is only with SEF disabled.
The site uses Joomla how should I go about fixing this? Also, I cannot access the administrator area I am guessing because of the same issue so I am working with the file manager.
This is my htaccess
##
# #package Joomla
# #copyright Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved.
# #license GNU General Public License version 2 or later; see LICENSE.txt
##
##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# 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 disallows 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.
##
## No directory listings
IndexIgnore *
## Can be commented out if causes errors, see notes above.
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymlinks
Options +SymLinksIfOwnerMatch
Options -Indexes
## Mod_rewrite in use.
RewriteEngine Off
## 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]
#
## End - Joomla! core SEF Section.
I fixed the issue by changing the live site URL in the configuration.php from example.com to http://example.com. I was able to reenable SEF after that and everything works.
I realized when looking at the source code that the URLs were correct but where they lead to was incorrect. Which then lead me to recheck the config file for the millionth time and I just tried the change above and it worked!

Configuring MODx Revolution to work with both http and https

I have a website using MODx Revolution (2.2.10-pl, advanced install), let's call it www.example.com, which I want to be accessible with both http and https.
to achieve this, I tweaked the site_url context setting to be [[++url_scheme]]www.example.com/. Links created using [[~id]] seem to be alright, however, sometimes, the generated links are really weird. My interpretation is that the code to create links programmatically doesn't work with my settings, but I don't know why, or how else I would go about enabling both http and https.
Question first, examples below: How should I set the site_url or any other site/context setting so that links on my site work with both http and https? Optionally, is the behavior I see a bug, or expected behavior given Revolution's tag evaluation semantics?
Misbehavior examples:
When I click on "View" in the manager for a resource with the alias example, the address that is opened is
https://www.example.com/xyz/[[++url_scheme]]www.example.com/example/
where xyz is my manager URL. The expected URL is of course
https://www.example.com/example/
Another case where this happens is for failed logins; my login call looks like this (minus irrelevant parts):
[[!Login? &redirectToOnFailedAuth=`[[++unauthorized_page]]`]]
The unauthorized_page's expected full URL is
https://www.example.com/special/401
but the URL which is opened for a failed login as username is
https://www.example.com/[[++url_scheme]]www.example.com/[[++url_scheme]]www.example.com/special/401?u=username
The second example is the same for http, except for the scheme, of course; I haven't logged into the manager with http.
EDIT
.htaccess at the webroot:
RewriteEngine On
RewriteBase /
# redirect all requests to /en/favicon.ico to /favicon.ico
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(en)/favicon.ico$ favicon.ico [L,QSA]
#RewriteRule ^(en|nl|de)/favicon.ico$ favicon.ico [L,QSA]
# redirect all requests to /en/assets* /assets*
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(en)/assets(.*)$ assets$2 [L,QSA]
#RewriteRule ^(en|nl|de)/assets(.*)$ assets$2 [L,QSA]
# redirect all other requests to /en/*
# to index.php and set the cultureKey parameter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(en)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
#RewriteRule ^(en|nl|de)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
.htaccess in the manager's directory:
RewriteEngine On
RewriteBase /
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/xyz/$1
The problem is with $modx->makeUrl(). For example, for the
[[!Login? &redirectToOnFailedAuth=`[[++unauthorized_page]]`]]
call, in core/components/login/controllers/web/Login.php:
public function checkForRedirectOnFailedAuth(modProcessorResponse $response) {
$redirectToOnFailedAuth = $this->getProperty('redirectToOnFailedAuth',false,'isset');
if ($redirectToOnFailedAuth && $redirectToOnFailedAuth != $this->modx->resource->get('id')) {
$p = array(
'u' => $this->dictionary->get('username'),
);
$message = $response->getMessage();
if (!empty($message)) $params['m'] = $message;
$url = $this->modx->makeUrl($redirectToOnFailedAuth,'',$p,'full');
$this->modx->sendRedirect($url);
}
}
the last two lines do a redirect to a URL generated with makeUrl, which will be something like [[++url_scheme]]www.example.com/etc (note: I'm not 100% sure here, as I can't easily look at the raw URL. The conclusions still hold, though). If the URL is simply shown on the page, this is no problem, because MODx will parse the tag before inserting it into the html output. However, as the URL is used directly for the redirect, no such replacement takes place, and the browser interprets it as a relative URL, resulting in target URLs such as https://www.example.com/[[++url_scheme]]www.example.com/etc.
So much for the problem. To avoid this, site_url must be a literal value without any tags in it. As a workaround, I now use the following snippet as the first thing in my template:
$modx->config['site_url'] = $modx->config['url_scheme'] . substr($modx->config['site_url'], strlen('[[++url_scheme]]'));
return '';
together with a [[++site_url]] of
[[++url_scheme]]www.example.com/
Note that some parts of MODx don't seem to notice this update, which is why it's important to still use [[++url_scheme]] in your site_url. As far as I can tell right now, the parts that don't see the update, stuff like [[~id]], work properly with url_scheme.
EDIT this does of course only fix the "View" buttons in the manager if you tweak the manager templates accordingly.
WARNING this is of course very hacky, and not yet tested very well. The fact that some features do not see the overwritten value means that you're introducing an inconsistency into your website, which may lead to subtle errors! If a more clean solution comes up, go for it!

Mod Rewrite Partial Matching

I'm writing a web app and trying to use mod rewrite to pretty up my URL's. I'm using the following in my htaccess file but there is a problem. If you try to go to /members it takes you to the right page but if you try to go to /members/1234 it still takes you to the members.php page not the member_profile.php page. I know this is because the request is matching the first rule but I don't know the best way to fix this. Should I just reorder them with the most restrictive first or is there a more correct way? Thanks.
RewriteEngine On
# prevent indexing directories
Options -Indexes
# members section
RewriteRule ^members /scripts/members.php
# member profile page
RewriteRule ^members/([0-9]+) /scripts/member_profile.php?id=$1
# groups section
RewriteRule ^groups /scripts/groups.php
# group profile page
RewriteRule ^groups/([0-9]+) /scripts/group_profile.php?id=$1
You need to match against the end of the string using $ (and you also need to use the L flag to stop rewriting):
RewriteEngine On
# prevent indexing directories
Options -Indexes
# members section
RewriteRule ^members$ /scripts/members.php [L]
# member profile page
RewriteRule ^members/([0-9]+)$ /scripts/member_profile.php?id=$1 [L]
# groups section
RewriteRule ^groups$ /scripts/groups.php [L]
# group profile page
RewriteRule ^groups/([0-9]+)$ /scripts/group_profile.php?id=$1 [L]

TYPO3 - Encoding caching parameters in the filename

I've read that some proxies dont cache resources with "?" queries in their URL. Reference
Is there a way to turn make the parameter a part of the filename?
(I guess that means turning style.css?v=123456 into style.123456.css)
Yes - there is such param called: versionNumberInFilename. You can set them in InstallTool->All Configuration or manually in typo3conf/localconf.php
Take care that there is such parameter for BE (backend) and separete for FE (frontend)
For backend you need to set it to "1". So finally in you typo3conf/localconf.php file there will be added line:
$TYPO3_CONF_VARS['BE']['versionNumberInFilename'] = '1'
For frontend you need to set it to "embed". So finally in you typo3conf/localconf.php file there will be added line:
$TYPO3_CONF_VARS['FE']['versionNumberInFilename'] = 'embed';
Then make sure the lines below are in your .htaccess so the files with numbers inside are properly resolved. In the latest versions of TYPO3 its by default active.
# Rule for versioned static files, configured through:
# - $TYPO3_CONF_VARS['BE']['versionNumberInFilename']
# - $TYPO3_CONF_VARS['FE']['versionNumberInFilename']
# IMPORTANT: This rule has to be the very first RewriteCond in order to work!
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]

Using mod_rewrite to redirect all pages in folder on old domain to index of new domain

I'm trying to redirect all pages on an old site (wellnowwhat.net/nin/*.*) to the index of a new site (sykonaut.net/nin_old/). I only have access to the new site's .htaccess (the old site is owned by a friend), so I'm testing going the opposite direction. I can redirect the root (sykonaut.net) to his root (wellnowwhat.net) using mod_rewrite, but I cannot redirect my nin_old directory to his nin directory. I'm guessing I wouldn't be able to redirect the opposite direction, either. Here is [the entirety of] the code in my .htaccess:
AddHandler php5_2-wrap .php
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.sykonaut.net$ [NC]
RewriteRule ^/nin_old(.*)$ http://www.wellnowwhat.net/nin [R,NC,L]
It does not work. Anyone know why?
Place your .htaccess in the nin_old directory.
RewriteEngine on
RewriteBase /nin_old
RewriteRule ^.* http://www.wellnowwhat.net/nin/ [R,NC,L]
When you redirect to an external URL to a directory, I would add the trailing slash as this reduce an extra redirection.
Also when you test everything and it's all right, change R to R=301 as this is preferred by most search engine for Permanent Redirection.
In apache 2.0 and higher, the prefix (leading "/") is removed from the URI before it's put through the rewrite engine for rules in the .htaccess file. Try removing the leading slash from your regular expression in your rule:
RewriteRule ^nin_old(.*)$ http://www.wellnowwhat.net/nin [R,NC,L]

Resources