Redirects won’t work, via htaccess or Redirect component

Need help with the Administration of your Joomla! 3.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
starlight
Joomla! Intern
Joomla! Intern
Posts: 72
Joined: Tue Aug 23, 2005 8:07 am

Redirects won’t work, via htaccess or Redirect component

Post by starlight » Tue Jun 12, 2018 2:42 pm

I have some articles that I moved from one category to another, so the URLs (aliases) are different. I wanted to do redirects for these, but I can’t as nothing works, whether in .htaccess via the cPanel Redirects feature or by adding them to the Redirects component. In all cases, if I go to the old link, I get:
“You are not authorised to view this resource”.

I suspect it might be something to do with cPanel adding stuff to the .htaccess file: it adds stuff inside the Joomla .htaccess lines, and adds redirects at the bottom (or, sometimes, anywhere below Joomla’s default stuff). So, my .htaccess looks like this:
## Begin - Joomla! core SEF Section.
#
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
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
# and the requested path and file doesn't directly match a physical file
# and the requested path and file doesn't directly match a physical folder
# internally rewrite the request to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule .* index.php [L]
#
## End - Joomla! core SEF Section.

<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from xx.xx.xx.xx/xx
deny from x.x.xx.xx
deny from xx.xx.xx.xx

RewriteCond %{HTTP_HOST} ^xxxxxx\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.xxxxxx\.com$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^aaaaa\-bbb\-cccccc\/1058\-name\-of\-article$ "http\:\/\/www\.xxxxxx\.com\/aaaaa\-bbb\-cccccc\/1070\-name\-of\-article" [R=301,L]

(repeat above for each redirect)
How can I get these redirects to work?

parfumylacno
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Tue Apr 23, 2013 9:29 am

Re: Redirects won’t work, via htaccess or Redirect component

Post by parfumylacno » Fri Jun 15, 2018 9:10 am

did you try make redirects with Joomla redirect compoment? I have made all my redirect of articles here. (exept redirect of non www to www version, that is made in httacces file)

starlight
Joomla! Intern
Joomla! Intern
Posts: 72
Joined: Tue Aug 23, 2005 8:07 am

Re: Redirects won’t work, via htaccess or Redirect component

Post by starlight » Fri Jun 15, 2018 10:47 am

Yes I did, as per my original message:
nothing works, whether in .htaccess via the cPanel Redirects feature or by adding them to the Redirects component.
:)

gws
Joomla! Champion
Joomla! Champion
Posts: 5947
Joined: Tue Aug 23, 2005 1:56 pm
Location: South coast, UK
Contact:

Re: Redirects won’t work, via htaccess or Redirect component

Post by gws » Fri Jun 15, 2018 11:19 am

Try using just the standard joomla .htaccess and make it 444 so nothing writes to it and then test the redirect component.

starlight
Joomla! Intern
Joomla! Intern
Posts: 72
Joined: Tue Aug 23, 2005 8:07 am

Re: Redirects won’t work, via htaccess or Redirect component

Post by starlight » Fri Jun 15, 2018 3:13 pm

I am using the standard Joomla .htaccess, but as I said above:
I suspect it might be something to do with cPanel adding stuff to the .htaccess file: it adds stuff inside the Joomla .htaccess lines, and adds redirects at the bottom (or, sometimes, anywhere below Joomla’s default stuff).
If I delete it, cPanel just puts back those extra lines - above every line with "RewriteRule .*" - with
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
I don't know enough about .htaccess, but I suspect this might be what's causing the redirects to not work?

I don't want to make it unwritable either, as I may need cPanel or other to write it to it for different reasons; it's also easier to add some things via cPanel than manually typing them in :)


Locked

Return to “Administration Joomla! 3.x”