Domain name in url multiple times - joomla

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!

Related

joomla site directs to not found object

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

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]

.htaccess redirect to page with anchor link

I'm trying to set up a .htaccess file to redirect pages from one domain to another. Works in 99% of cases, the RewriteRules that aren't working are like the one below - if the outbound URL has an #anchor tag, the # symbol is converted into the characters %23 in the browser and then the page does not load at the anchor. Any idea on how to interpret the # tag correctly?
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php
Options -MultiViews
Options +FollowSymlinks
RewriteEngine on
RewriteRule bg/row_b1_i_pn1.php http://example.org/s-b-g/b-1#illustration-110
If I cut and paste "http://example.org/s-b-g/b-1#illustration-110" into my browser directly, it loads just fine, but using the RewriteRule, the URL that loads is "http://example.org/s-b-g/b-1%23illustration-110" ... The new site is a drupal site, if that helps any. Thanks.
Try it with the NE flag:
RewriteRule bg/row_b1_i_pn1.php http://example.org/s-b-g/b-1#illustration-110 [NE]
because .htaccess usually interprets # as a comment it kind of defeats proper interpretation ..
so instead of using the # in your rewrite rule actually use the %23 code instead.
so your rewrite becomes:
RewriteRule bg/row_b1_i_pn1.php http://example.org/s-b-g/b-1%23illustration-110 [NE]
more accurately is becomes:
RewriteRule bg/row_b1_i_pn1.php http://example.org/s-b-g/b-1/%23illustration-110 [NE]

Resources