× Here you can get community support related to ReDJ.

There is a redirect loop on my custom 404 page

  • King Gee
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 7 months ago #4266 by King Gee
Hello Luigi,
Thanks greatly for developing this wonderful plugin!
My Joomla Version= 3.4.4
ReDJ Version=1.7.8
PHP version= 5.5.28

I wasn't having any problem with redirection of bad urls to the custom 404 page of which I had modified the system error.php and replaced in the Protostar template directory until recently when I installed a new template and replaced the custom error.php file in its directory.

Now with the same ReDJ plugin settings (please see the attached screenshot:

), the message I get when I type in a "bad url" to access the 404 page (www.mysite.com/index.php?option=com_content&view=article&id=588) is: This webpage has a redirect loop

After researching, I renamed my .htaccess file and this was the message I had typing a "bad url" : Not Found
The requested URL / was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


I have tried all available means but with no success and so, I would very glad if you could help me out here with the below error and details of my .htaccess file where I think there could be a bad REDIRECT RULE set. Thanks very much!

PLEASE NOTE: I HAVE COMMENTED OUT SITENAME AND DATABASENAME FOR SECURITY REASONS

After setting the error reporting to maximum, this is the error I got:
jos-Warning: exception 'RuntimeException' with message 'Deadlock found when trying to get lock; try restarting transaction SQL=INSERT INTO (database name)_redj_errors (`visited_url`, `error_code`, `redirect_url`, `hits`, `last_visit`, `last_referer`) VALUES ('www.mysite.com/index.php?option=com_content&view=article&id=588', '404', '', 1, '2015-09-17 20:33:22', '') ON DUPLICATE KEY UPDATE `hits` = `hits` + 1, `last_visit` = '2015-09-17 20:33:22', `last_referer` = ''' in /home/sitename/public_html/libraries/joomla/database/driver/mysqli.php:610 Stack trace: #0 /home/sitename/public_html/libraries/joomla/database/database.php(33): JDatabaseDriverMysqli->execute() #1 /home/sitename/public_html/plugins/system/redj/redj.php(520): JDatabase->query() #2 /home/sitename/public_html/plugins/system/redj/redj.php(638): plgSystemReDJ::manageError(Object(Exception)) #3 [internal function]: plgSystemReDJ::customError(Object(JException)) #4 /home/sitename/public_html/libraries/legacy/error/error.php(760): call_user_func(Array, Object(JException)) #5 [internal function]: JError::handleCallback(Object(JException), Array) #6 /home/sitename/public_html/libraries/legacy/error/error.php(218): call_user_func_array(Array, Array) #7 /home/sitenamepublic_html/libraries/legacy/error/error.php(179): JError::throwError(Object(JException)) #8 /home/sitenamepublic_html/libraries/legacy/error/error.php(254): JError::raise(1, 404, 'Article not fou...', NULL, true) #9 /home/sitenamepublic_html/components/com_content/models/article.php(169): JError::raiseError(404, 'Article not fou...') #10 /home/sitename/public_html/libraries/legacy/view/legacy.php(401): ContentModelArticle->getItem() #11 /home/sitename/public_html/components/com_content/views/article/view.html.php(42): JViewLegacy->get('Item') #12 /home/sitename/public_html/libraries/legacy/controller/legacy.php(690): ContentViewArticle->display() #13 /home/sitename/public_html/components/com_content/controller.php(104): JControllerLegacy->display(true, Array) #14 /home/sitename/public_html/libraries/legacy/controller/legacy.php(728): ContentController->display() #15 /home/sitename/public_html/components/com_content/content.php(16): JControllerLegacy->execute(NULL) #16 /home/sitename/public_html/libraries/cms/component/helper.php(392): require_once('/home/sitename/p...') #17 /home/sitename/public_html/libraries/cms/component/helper.php(372): JComponentHelper::executeComponent('/home/bigtinz/p...') #18 /home/sitename/public_html/libraries/cms/application/site.php(191): JComponentHelper::renderComponent('com_content') #19 /home/sitename/public_html/libraries/cms/application/site.php(230): JApplicationSite->dispatch() #20 /home/sitename/public_html/libraries/cms/application/cms.php(252): JApplicationSite->doExecute() #21 /home/sitename/public_html/index.php(45): JApplicationCms->execute() #22 {main}

Here are the details of my HTACCESS file:
.....continued below:
### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
### !! !!
### !! If you get an Internal Server Error 500 or a blank page when trying !!
### !! to access your site, remove this file and try tweaking its settings !!
### !! in the back-end of the Admin Tools component. !!
### !! !!
### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
###

##### RewriteEngine enabled - BEGIN
RewriteEngine On
RewriteCond %{HTTP_HOST} ^sitename [NC]
RewriteRule (.*) www.sitename/$1 [L,R=301]
##### RewriteEngine enabled - END

##### RewriteBase set - BEGIN
RewriteBase /
##### RewriteBase set - END

##### File execution order -- BEGIN
DirectoryIndex index.php index.html
##### File execution order -- END

##### No directory listings -- BEGIN
IndexIgnore *
Options -Indexes
##### No directory listings -- END

##### Optimal default expiration time - BEGIN
<IfModule mod_expires.c>
# Enable expiration control
ExpiresActive On

# Default expiration: 1 day after request
ExpiresDefault "now plus 1 day"

# CSS and JS expiration: 1 month after request
ExpiresByType text/css "now plus 1 month"
ExpiresByType application/javascript "now plus 1 month"
ExpiresByType application/x-javascript "now plus 1 month"

# Favicon files expiration: 1 year after request
ExpiresByType image/x-icon "now plus 1 year"
ExpiresByType image/ico "now plus 1 year"
ExpiresByType image/icon "now plus 1 year"
ExpiresByType text/ico "now plus 1 year"
ExpiresByType application/ico "now plus 1 year"

# Gif file expiration: 1 year after request
ExpiresByType image/gif "now plus 1 year"

# Png file expiration: 1 year after request
ExpiresByType image/png "now plus 1 year"

# Image files expiration: 1 month after request
ExpiresByType image/bmp "now plus 1 month"
ExpiresByType image/jpeg "now plus 1 month"
ExpiresByType image/jp2 "now plus 1 month"
ExpiresByType image/pipeg "now plus 1 month"
ExpiresByType image/svg+xml "now plus 1 month"
ExpiresByType image/tiff "now plus 1 month"
ExpiresByType image/vnd.microsoft.icon "now plus 1 month"
ExpiresByType image/vnd.wap.wbmp "now plus 1 month"
ExpiresByType application/vnd.wap.wbxml "now plus 1 month"
ExpiresByType application/smil "now plus 1 month"

# Audio files expiration: 1 month after request
ExpiresByType audio/ogg "now plus 1 month"
ExpiresByType application/ogg "now plus 1 month"
ExpiresByType audio/basic "now plus 1 month"
ExpiresByType audio/mid "now plus 1 month"
ExpiresByType audio/midi "now plus 1 month"
ExpiresByType audio/mpeg "now plus 1 month"
ExpiresByType audio/mp3 "now plus 1 month"
ExpiresByType audio/x-aiff "now plus 1 month"
ExpiresByType audio/x-mpegurl "now plus 1 month"
ExpiresByType audio/x-pn-realaudio "now plus 1 month"
ExpiresByType audio/x-wav "now plus 1 month"

# Movie files expiration: 1 month after request
ExpiresByType application/x-shockwave-flash "now plus 1 month"
ExpiresByType x-world/x-vrml "now plus 1 month"
ExpiresByType video/x-msvideo "now plus 1 month"
ExpiresByType video/mpeg "now plus 1 month"
ExpiresByType video/mp4 "now plus 1 month"
ExpiresByType video/quicktime "now plus 1 month"
ExpiresByType video/x-la-asf "now plus 1 month"
ExpiresByType video/x-ms-asf "now plus 1 month"
</IfModule>
##### Optimal default expiration time - END

##### Common hacking tools and bandwidth hoggers block -- BEGIN
SetEnvIf user-agent "Indy Library" stayout=1
SetEnvIf user-agent "libwww-perl" stayout=1
SetEnvIf user-agent "Download Demon" stayout=1
SetEnvIf user-agent "GetRight" stayout=1
SetEnvIf user-agent "GetWeb!" stayout=1
SetEnvIf user-agent "Go!Zilla" stayout=1
SetEnvIf user-agent "Go-Ahead-Got-It" stayout=1
SetEnvIf user-agent "GrabNet" stayout=1
SetEnvIf user-agent "TurnitinBot" stayout=1
<IfModule !mod_authz_core.c>
deny from env=stayout
</IfModule>
<IfModule mod_authz_core.c>
<RequireAll>
Require all granted
Require not env stayout
</RequireAll>
</IfModule>
##### Common hacking tools and bandwidth hoggers block -- END

##### Automatic compression of resources -- BEGIN
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
</ifmodule>
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_keep_workfiles No
mod_gzip_can_negotiate Yes
mod_gzip_add_header_count Yes
mod_gzip_send_vary Yes
mod_gzip_min_http 1000
mod_gzip_minimum_file_size 300
mod_gzip_maximum_file_size 512000
mod_gzip_maximum_inmem_size 60000
mod_gzip_handle_methods GET
mod_gzip_item_include file \.(html?|txt|css|js|php|pl|xml|rb|py)$
mod_gzip_item_include mime ^text/plain$
mod_gzip_item_include mime ^text/xml$
mod_gzip_item_include mime ^text/css$
mod_gzip_item_include mime ^application/xml$
mod_gzip_item_include mime ^application/xhtml+xml$
mod_gzip_item_include mime ^application/rss+xml$
mod_gzip_item_include mime ^application/javascript$
mod_gzip_item_include mime ^application/x-javascript$
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include handler ^server-status$
mod_gzip_item_include handler ^server-info$
mod_gzip_item_include handler ^application/x-httpd-php
mod_gzip_item_exclude mime ^image/.*
</ifmodule>
##### Automatic compression of resources -- END
## Force GZip compression for mangled Accept-Encoding headers
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
</IfModule>
</IfModule>
##### Redirect index.php to / -- BEGIN
RewriteCond %{THE_REQUEST} !^POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteCond %{SERVER_PORT}>s ^(443>(s)|[0-9]+>s)$
RewriteRule ^index\.php$ http%2://www.sitename.com/ [R=301,L]
##### Redirect index.php to / -- END
##### Redirect non-www to www -- BEGIN
#####RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
#####RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
##### Redirect non-www to www -- END

##### Rewrite rules to block out some common exploits -- BEGIN
RewriteCond %{QUERY_STRING} proc/self/environ [OR]
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
RewriteCond %{QUERY_STRING} base64_(en|de)code\(.*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]
##### Rewrite rules to block out some common exploits -- END
##### File injection protection -- BEGIN
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]
RewriteRule .* - [F]
##### File injection protection -- END

##### Advanced server protection rules exceptions -- BEGIN
RewriteRule ^administrator\/components\/com_akeeba\/restore\.php$ - [L]
RewriteRule ^administrator\/components\/com_admintools\/restore\.php$ - [L]
RewriteRule ^administrator\/components\/com_joomlaupdate\/restore\.php$ - [L]
RewriteRule ^templates\/your_template_name_here/ - [L]
##### Advanced server protection rules exceptions -- END

##### Advanced server protection -- BEGIN

RewriteCond %{QUERY_STRING} \=PHP[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12} [NC]
RewriteRule .* - [F]
## Back-end protection
RewriteRule ^administrator/?$ - [L]
RewriteRule ^administrator/index\.(php|html?)$ - [L]
RewriteRule ^administrator/index[23]\.php$ - [L]
RewriteRule ^administrator/(components|modules|templates|images|plugins)/.*\.(jpe|jpg|jpeg|jp2|jpe2|png|gif|bmp|css|js|swf|html|mpg|mp3|mpeg|mp4|avi|wav|ogg|ogv|xls|xlsx|doc|docx|ppt|pptx|zip|rar|pdf|xps|txt|7z|svg|odt|ods|odp|flv|mov|htm|ttf|woff|eot)$ - [L]
RewriteRule ^administrator/ - [F]
## Allow limited access for certain Joomla! system directories with client-accessible content
RewriteRule ^(components|modules|templates|images|plugins|media|libraries|media/jui/fonts)/.*\.(jpe|jpg|jpeg|jp2|jpe2|png|gif|bmp|css|js|swf|html|mpg|mp3|mpeg|mp4|avi|wav|ogg|ogv|xls|xlsx|doc|docx|ppt|pptx|zip|rar|pdf|xps|txt|7z|svg|odt|ods|odp|flv|mov|ico|htm|ttf|woff|eot|xml)$ - [L]
RewriteRule ^(components|modules|templates|images|plugins|media|libraries|media/jui/fonts)/ - [F]
## Disallow front-end access for certain Joomla! system directories (unless access to their files is allowed above)
RewriteRule ^includes/js/ - [L]
RewriteRule ^(cache|includes|language|logs|log|tmp)/ - [F]
RewriteRule ^(configuration\.php|CONTRIBUTING\.md|htaccess\.txt|joomla\.xml|LICENSE\.txt|phpunit\.xml|README\.txt|web\.config\.txt) - [F]

## Disallow access to rogue PHP files throughout the site, unless they are explicitly allowed
RewriteCond %{REQUEST_FILENAME} (\.php)$
RewriteCond %{REQUEST_FILENAME} !(/index[23]?\.php)$
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule (.*\.php)$ - [F]
## Disallow access to htaccess.txt, php.ini and configuration.php-dist
RewriteRule ^(htaccess\.txt|configuration\.php-dist|php\.ini)$ - [F]
## Protect against clickjacking
<IfModule mod_headers.c>

Header always append X-Frame-Options SAMEORIGIN

# The `X-Frame-Options` response header should be send only for
# HTML documents and not for the other resources.

<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|woff2?|xloc|xml|xpi)$">
Header unset X-Frame-Options
</FilesMatch>

</IfModule>
## Reduce MIME type security risks
<IfModule mod_headers.c>
Header set X-Content-Type-Options "nosniff"
</IfModule>
## Reflected XSS prevention
<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
</IfModule>

# mod_headers cannot match based on the content-type, however,
# the X-XSS-Protection response header should be send only for
# HTML documents and not for the other resources.

<IfModule mod_headers.c>
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
Header unset X-XSS-Protection
</FilesMatch>
</IfModule>
## Remove Apache and PHP version signature
<IfModule mod_headers.c>
Header unset X-Powered-By
</IfModule>

ServerSignature Off
## Prevent content transformation
<IfModule mod_headers.c>
Header merge Cache-Control "no-transform"
</IfModule>
##### Advanced server protection -- END

## Set the UTF-8 character set as the default
# Serve all resources labeled as `text/html` or `text/plain`
# with the media type `charset` parameter set to `UTF-8`.

AddDefaultCharset utf-8

# Serve the following file types with the media type `charset`
# parameter set to `UTF-8`.
#
# httpd.apache.org/docs/current/mod/mod_mime.html#addcharset

<IfModule mod_mime.c>
AddCharset utf-8 .atom \
.bbaw \
.css \
.geojson \
.js \
.json \
.jsonld \
.rdf \
.rss \
.topojson \
.vtt \
.webapp \
.xloc \
.xml
</IfModule>
##### Joomla! core SEF Section -- BEGIN
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
##### Joomla! core SEF Section -- END



<Files ~ "sitemap\.xml$">
Order allow,deny
Allow from all
</Files>

<Files ~ "six\.xml$">
Order allow,deny
Allow from all
</Files>

FileETag None

RewriteRule ^sitemap.xml$ index.php?option=com_osmap&view=xml&tmpl=component&id=1 [L]

suPHP_ConfigPath /home/sitename/public_html
Attachments:

Please Log in or Create an account to join the conversation.

More
8 years 7 months ago #4268 by admin
Hi,
this is a really tricky problem and, moreover, I am not sure this is a single problem. But with the information you provided me (expecially www.mysite.com) I cannot make any tests.

We could schedule a remote support session, so yu can show me your desktop with Team Viewer and we can fix the problem. If you agree, send me an email at info(at)selfget.com with a link to this post.

Kind regards,
Luigi
The following user(s) said Thank You: King Gee

Please Log in or Create an account to join the conversation.

  • King Gee
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 7 months ago #4269 by King Gee
Replied by King Gee on topic There is a redirect loop on my custom 404 page
Hello Luigi,

Thanks very much for your response!

Please, I have replied to the above email as you have requested with more details. Thanks once again and waiting for a response!

Please Log in or Create an account to join the conversation.

More
8 years 7 months ago #4271 by admin
Hi,
we will follow up by email.
The following user(s) said Thank You: King Gee

Please Log in or Create an account to join the conversation.

  • King Gee
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 7 months ago #4272 by King Gee
Replied by King Gee on topic There is a redirect loop on my custom 404 page
Hello Luigi,

Thanks very much for your response. Okay and waiting!

Thanks once again!

Please Log in or Create an account to join the conversation.

More
8 years 7 months ago #4273 by admin
Check your mailbox :)

Please Log in or Create an account to join the conversation.

Time to create page: 0.204 seconds