0

I've migrated a J3 site to J4 and have an issue with article URL's. In J3 an article would load /category/article i.e. https://old.lymington.com/133-locally/1458-a-guide-to-beaches-near-lymington-and-the-new-forest

There was a hidden menu item for 'Articles > List All Categories' with the alias 'lymington' which was put in place in J3 to enable these direct links (I believe many years back this was necessary to get the clean SEF URL's on articles). So the article does also load on https://old.lymington.com/lymington/133-locally/1458-a-guide-to-beaches-near-lymington-and-the-new-forest

On J4 I have tried everything I can think of, including the direct alias plugin, to try and load the URL's as https://www.lymington.com/133-locally/1458-a-guide-to-beaches-near-lymington-and-the-new-forest without the hidden menu item alias i.e. https://www.lymington.com/lymington/133-locally/1458-a-guide-to-beaches-near-lymington-and-the-new-forest but the url without the menu alias included always returns a 404. I can't seem to remove the /lymington/ hidden menu alias from the URL.

Disabling the hidden menu category item gives a URL such as https://lymington.com/lymington-life/locally?view=article&id=1458:a-guide-to-beaches-near-lymington-and-the-new-forest&catid=133 which is clearly not SEF.

I'm sure I must be missing something somewhere obvious. Maybe it's a can't see the wood for the trees situation?

Is there anyway around this? I understand the URL router works differently in J4 but surely there is a solution? As it stands, it's not very SEO friendly.

My current .htaccess is below:

### ===========================================================================
### Security Enhanced & Highly Optimized .htaccess File for Joomla!
### automatically generated by Admin Tools 6.1.4 on 2023-07-07 08:33:32 BST
### Auto-detected Apache version: 2.0 (best guess)
### ===========================================================================
###
### The contents of this file are based on the same author's work "Master
### .htaccess".
###
### Admin Tools is Free Software, distributed under the terms of the GNU
### General Public License version 3 or, at your option, any later version
### published by the Free Software Foundation.
###
### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
### !!                                                                       !!
### !!  If you get an Internal Server Error 500 or a blank page when t
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /some/subdir/projects[/?\s]rying  !!
### !!  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
##### RewriteEngine enabled - END

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

RewriteRule !^news(/|$) lymington%{REQUEST_URI} [L]
RewriteRule ^news/?([^/].+)?$ /lymington/$1 [L,R=301]

##### Remove /lymington/ menu alias from url
RewriteRule ^lymington/(.*)$ $1

##### Custom Rules (Top of File) -- BEGIN
<IfModule LiteSpeed>
    CacheLookup on
</IfModule>
##### Custom Rules (Top of File) -- 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

##### Common hacking tools and bandwidth hoggers block -- BEGIN
SetEnvIf user-agent "(?i:WebBandit)" stayout=1
SetEnvIf user-agent "(?i:webbandit)" stayout=1
SetEnvIf user-agent "(?i:Acunetix)" stayout=1
SetEnvIf user-agent "(?i:binlar)" stayout=1
SetEnvIf user-agent "(?i:BlackWidow)" stayout=1
SetEnvIf user-agent "(?i:Bolt 0)" stayout=1
SetEnvIf user-agent "(?i:Bot mailto:[email protected])" stayout=1
SetEnvIf user-agent "(?i:BOT for JCE)" stayout=1
SetEnvIf user-agent "(?i:casper)" stayout=1
SetEnvIf user-agent "(?i:checkprivacy)" stayout=1
SetEnvIf user-agent "(?i:ChinaClaw)" stayout=1
SetEnvIf user-agent "(?i:clshttp)" stayout=1
SetEnvIf user-agent "(?i:cmsworldmap)" stayout=1
SetEnvIf user-agent "(?i:comodo)" stayout=1
SetEnvIf user-agent "(?i:Custo)" stayout=1
SetEnvIf user-agent "(?i:Default Browser 0)" stayout=1
SetEnvIf user-agent "(?i:diavol)" stayout=1
SetEnvIf user-agent "(?i:DIIbot)" stayout=1
SetEnvIf user-agent "(?i:DISCo)" stayout=1
SetEnvIf user-agent "(?i:dotbot)" stayout=1
SetEnvIf user-agent "(?i:Download Demon)" stayout=1
SetEnvIf user-agent "(?i:eCatch)" stayout=1
SetEnvIf user-agent "(?i:EirGrabber)" stayout=1
SetEnvIf user-agent "(?i:EmailCollector)" stayout=1
SetEnvIf user-agent "(?i:EmailSiphon)" stayout=1
SetEnvIf user-agent "(?i:EmailWolf)" stayout=1
SetEnvIf user-agent "(?i:Express WebPictures)" stayout=1
SetEnvIf user-agent "(?i:extract)" stayout=1
SetEnvIf user-agent "(?i:ExtractorPro)" stayout=1
SetEnvIf user-agent "(?i:EyeNetIE)" stayout=1
SetEnvIf user-agent "(?i:feedfinder)" stayout=1
SetEnvIf user-agent "(?i:FHscan)" stayout=1
SetEnvIf user-agent "(?i:FlashGet)" stayout=1
SetEnvIf user-agent "(?i:flicky)" stayout=1
SetEnvIf user-agent "(?i:GetRight)" stayout=1
SetEnvIf user-agent "(?i:GetWeb!)" stayout=1
SetEnvIf user-agent "(?i:Go-Ahead-Got-It)" stayout=1
SetEnvIf user-agent "(?i:Go!Zilla)" stayout=1
SetEnvIf user-agent "(?i:grab)" stayout=1
SetEnvIf user-agent "(?i:GrabNet)" stayout=1
SetEnvIf user-agent "(?i:Grafula)" stayout=1
SetEnvIf user-agent "(?i:harvest)" stayout=1
SetEnvIf user-agent "(?i:HMView)" stayout=1
SetEnvIf user-agent "(?i:ia_archiver)" stayout=1
SetEnvIf user-agent "(?i:Image Stripper)" stayout=1
SetEnvIf user-agent "(?i:Image Sucker)" stayout=1
SetEnvIf user-agent "(?i:InterGET)" stayout=1
SetEnvIf user-agent "(?i:Internet Ninja)" stayout=1
SetEnvIf user-agent "(?i:InternetSeer.com)" stayout=1
SetEnvIf user-agent "(?i:jakarta)" stayout=1
SetEnvIf user-agent "(?i:Java)" stayout=1
SetEnvIf user-agent "(?i:JetCar)" stayout=1
SetEnvIf user-agent "(?i:JOC Web Spider)" stayout=1
SetEnvIf user-agent "(?i:kmccrew)" stayout=1
SetEnvIf user-agent "(?i:larbin)" stayout=1
SetEnvIf user-agent "(?i:LeechFTP)" stayout=1
SetEnvIf user-agent "(?i:libwww)" stayout=1
SetEnvIf user-agent "(?i:Mass Downloader)" stayout=1
SetEnvIf user-agent "(?i:Maxthon$)" stayout=1
SetEnvIf user-agent "(?i:microsoft.url)" stayout=1
SetEnvIf user-agent "(?i:MIDown tool)" stayout=1
SetEnvIf user-agent "(?i:miner)" stayout=1
SetEnvIf user-agent "(?i:Mister PiX)" stayout=1
SetEnvIf user-agent "(?i:NEWT)" stayout=1
SetEnvIf user-agent "(?i:MSFrontPage)" stayout=1
SetEnvIf user-agent "(?i:Navroad)" stayout=1
SetEnvIf user-agent "(?i:NearSite)" stayout=1
SetEnvIf user-agent "(?i:Net Vampire)" stayout=1
SetEnvIf user-agent "(?i:NetAnts)" stayout=1
SetEnvIf user-agent "(?i:NetSpider)" stayout=1
SetEnvIf user-agent "(?i:NetZIP)" stayout=1
SetEnvIf user-agent "(?i:nutch)" stayout=1
SetEnvIf user-agent "(?i:Octopus)" stayout=1
SetEnvIf user-agent "(?i:Offline Explorer)" stayout=1
SetEnvIf user-agent "(?i:Offline Navigator)" stayout=1
SetEnvIf user-agent "(?i:PageGrabber)" stayout=1
SetEnvIf user-agent "(?i:Papa Foto)" stayout=1
SetEnvIf user-agent "(?i:pavuk)" stayout=1
SetEnvIf user-agent "(?i:pcBrowser)" stayout=1
SetEnvIf user-agent "(?i:PeoplePal)" stayout=1
SetEnvIf user-agent "(?i:planetwork)" stayout=1
SetEnvIf user-agent "(?i:psbot)" stayout=1
SetEnvIf user-agent "(?i:purebot)" stayout=1
SetEnvIf user-agent "(?i:pycurl)" stayout=1
SetEnvIf user-agent "(?i:RealDownload)" stayout=1
SetEnvIf user-agent "(?i:ReGet)" stayout=1
SetEnvIf user-agent "(?i:Rippers 0)" stayout=1
SetEnvIf user-agent "(?i:SeaMonkey$)" stayout=1
SetEnvIf user-agent "(?i:sitecheck.internetseer.com)" stayout=1
SetEnvIf user-agent "(?i:SiteSnagger)" stayout=1
SetEnvIf user-agent "(?i:skygrid)" stayout=1
SetEnvIf user-agent "(?i:SmartDownload)" stayout=1
SetEnvIf user-agent "(?i:sucker)" stayout=1
SetEnvIf user-agent "(?i:SuperBot)" stayout=1
SetEnvIf user-agent "(?i:SuperHTTP)" stayout=1
SetEnvIf user-agent "(?i:Surfbot)" stayout=1
SetEnvIf user-agent "(?i:tAkeOut)" stayout=1
SetEnvIf user-agent "(?i:Teleport Pro)" stayout=1
SetEnvIf user-agent "(?i:Toata dragostea mea pentru diavola)" stayout=1
SetEnvIf user-agent "(?i:Tor)" stayout=1
SetEnvIf user-agent "(?i:turnit)" stayout=1
SetEnvIf user-agent "(?i:vikspider)" stayout=1
SetEnvIf user-agent "(?i:VoidEYE)" stayout=1
SetEnvIf user-agent "(?i:Web Image Collector)" stayout=1
SetEnvIf user-agent "(?i:Web Sucker)" stayout=1
SetEnvIf user-agent "(?i:WebAuto)" stayout=1
SetEnvIf user-agent "(?i:WebCopier)" stayout=1
SetEnvIf user-agent "(?i:WebFetch)" stayout=1
SetEnvIf user-agent "(?i:WebGo IS)" stayout=1
SetEnvIf user-agent "(?i:WebLeacher)" stayout=1
SetEnvIf user-agent "(?i:WebReaper)" stayout=1
SetEnvIf user-agent "(?i:WebSauger)" stayout=1
SetEnvIf user-agent "(?i:Website eXtractor)" stayout=1
SetEnvIf user-agent "(?i:Website Quester)" stayout=1
SetEnvIf user-agent "(?i:WebStripper)" stayout=1
SetEnvIf user-agent "(?i:WebWhacker)" stayout=1
SetEnvIf user-agent "(?i:WebZIP)" stayout=1
SetEnvIf user-agent "(?i:Wget)" stayout=1
SetEnvIf user-agent "(?i:Widow)" stayout=1
SetEnvIf user-agent "(?i:WWW-Mechanize)" stayout=1
SetEnvIf user-agent "(?i:WWWOFFLE)" stayout=1
SetEnvIf user-agent "(?i:Xaldon WebSpider)" stayout=1
SetEnvIf user-agent "(?i:Yandex)" stayout=1
SetEnvIf user-agent "(?i:Zeus)" stayout=1
SetEnvIf user-agent "(?i:zmeu)" stayout=1
SetEnvIf user-agent "(?i:CazoodleBot)" stayout=1
SetEnvIf user-agent "(?i:discobot)" stayout=1
SetEnvIf user-agent "(?i:ecxi)" stayout=1
SetEnvIf user-agent "(?i:GT::WWW)" stayout=1
SetEnvIf user-agent "(?i:heritrix)" stayout=1
SetEnvIf user-agent "(?i:HTTP::Lite)" stayout=1
SetEnvIf user-agent "(?i:HTTrack)" stayout=1
SetEnvIf user-agent "(?i:ia_archiver)" stayout=1
SetEnvIf user-agent "(?i:id-search)" stayout=1
SetEnvIf user-agent "(?i:id-search.org)" stayout=1
SetEnvIf user-agent "(?i:IDBot)" stayout=1
SetEnvIf user-agent "(?i:Indy Library)" stayout=1
SetEnvIf user-agent "(?i:IRLbot)" stayout=1
SetEnvIf user-agent "(?i:ISC Systems iRc Search 2.1)" stayout=1
SetEnvIf user-agent "(?i:LinksManager.com_bot)" stayout=1
SetEnvIf user-agent "(?i:linkwalker)" stayout=1
SetEnvIf user-agent "(?i:lwp-trivial)" stayout=1
SetEnvIf user-agent "(?i:MFC_Tear_Sample)" stayout=1
SetEnvIf user-agent "(?i:Microsoft URL Control)" stayout=1
SetEnvIf user-agent "(?i:Missigua Locator)" stayout=1
SetEnvIf user-agent "(?i:panscient.com)" stayout=1
SetEnvIf user-agent "(?i:PECL::HTTP)" stayout=1
SetEnvIf user-agent "(?i:PHPCrawl)" stayout=1
SetEnvIf user-agent "(?i:PleaseCrawl)" stayout=1
SetEnvIf user-agent "(?i:SBIder)" stayout=1
SetEnvIf user-agent "(?i:Snoopy)" stayout=1
SetEnvIf user-agent "(?i:Steeler)" stayout=1
SetEnvIf user-agent "(?i:URI::Fetch)" stayout=1
SetEnvIf user-agent "(?i:urllib)" stayout=1
SetEnvIf user-agent "(?i:Web Sucker)" stayout=1
SetEnvIf user-agent "(?i:webalta)" stayout=1
SetEnvIf user-agent "(?i:WebCollage)" stayout=1
SetEnvIf user-agent "(?i:Wells Search II)" stayout=1
SetEnvIf user-agent "(?i:WEP Search)" stayout=1
SetEnvIf user-agent "(?i:zermelo)" stayout=1
SetEnvIf user-agent "(?i:ZyBorg)" stayout=1
SetEnvIf user-agent "(?i:Indy Library)" stayout=1
SetEnvIf user-agent "(?i:libwww-perl)" stayout=1
SetEnvIf user-agent "(?i:Go!Zilla)" stayout=1
SetEnvIf user-agent "(?i:TurnitinBot)" stayout=1
SetEnvIf user-agent "(?i:sqlmap)" 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

##### Redirect index.php to / -- BEGIN
RewriteCond %{THE_REQUEST} !^POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ / [R,L]
##### Redirect index.php to / -- 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[s]?:// [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_joomlaupdate\/restore\.php$ - [L]
RewriteRule ^plugins\/system\/bfnetwork\/bfnetwork\/bfPing\.php$ - [L]
RewriteRule ^plugins\/system\/bfnetwork\/bfnetwork\/bfSnapshot\.php$ - [L]
RewriteRule ^administrator\/components\/com_akeebabackup\/restore\.php$ - [L]
RewriteRule ^administrator\/components\/com_joomlaupdate\/extract\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !(\.php)$
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^\.well\-known/ - [L]
RewriteCond %{REQUEST_FILENAME} !(\.php)$
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^cache/ - [L]
RewriteRule ^templates\/rt_audacity/ - [L]
RewriteRule ^images\/\*/ - [L]
RewriteRule ^plugins\/system\/bfnetwork\/bfnetwork/ - [L]
##### Advanced server protection rules exceptions -- END

##### Advanced server protection -- BEGIN

## Disable PHP Easter Eggs
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/(components|modules|templates|images|plugins|cache)/.*\.(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|woff2|eot|webp|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|WOFF2|EOT|WEBP|xml|XML)$ - [L]
RewriteRule ^administrator/ - [F]
#### Disable client-side risky behavior in backend static content
<If "%{REQUEST_URI} =~ m#^/administrator/(components|modules|templates|images|plugins|cache)/.*\.(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|woff2|eot|webp|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|WOFF2|EOT|WEBP|xml|XML)$#">
    <IfModule mod_headers.c>
        Header always set Content-Security-Policy "default-src 'self'; script-src 'none';"
    </IfModule>
</If>
#### Front-end protection
## Allow limited access for certain directories with client-accessible content
RewriteRule ^(components|modules|templates|images|plugins|media|libraries|media/jui/fonts|cache)/.*\.(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|woff2|eot|webp|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|WOFF2|EOT|WEBP)$ - [L]
RewriteRule ^(components|modules|templates|images|plugins|media|libraries|media/jui/fonts|cache)/ - [F]
#### Disable client-side risky behavior in frontend static content
<If "%{REQUEST_URI} =~ m#^/(components|modules|templates|images|plugins|media|libraries|media/jui/fonts|cache)/.*\.(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|woff2|eot|webp|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|WOFF2|EOT|WEBP)$#">
    <IfModule mod_headers.c>
        Header always set Content-Security-Policy "default-src 'self'; script-src 'none';"
    </IfModule>
</If>
## 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]

## Explicitly allow access to the site's index.php main entry point file
RewriteRule ^index.php(/.*){0,1}$ - [L]
## Explicitly allow access to the site's robots.txt file
RewriteRule ^robots.txt$ - [L]

## Disallow access to all other PHP files throughout the site, unless they are explicitly allowed
RewriteCond %{REQUEST_FILENAME} (\.php)$
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule (.*\.php)$ - [F]
##### Advanced server protection rules exceptions also bypass the “disable client-side risky behavior” features -- BEGIN
<If "%{REQUEST_URI} == '/administrator/components/com_akeeba/restore.php'">
    <IfModule mod_headers.c>
        Header always unset Content-Security-Policy
    </IfModule>
</If>
<If "%{REQUEST_URI} == '/administrator/components/com_joomlaupdate/restore.php'">
    <IfModule mod_headers.c>
        Header always unset Content-Security-Policy
    </IfModule>
</If>
<If "%{REQUEST_URI} == '/plugins/system/bfnetwork/bfnetwork/bfPing.php'">
    <IfModule mod_headers.c>
        Header always unset Content-Security-Policy
    </IfModule>
</If>
<If "%{REQUEST_URI} == '/plugins/system/bfnetwork/bfnetwork/bfSnapshot.php'">
    <IfModule mod_headers.c>
        Header always unset Content-Security-Policy
    </IfModule>
</If>
<If "%{REQUEST_URI} == '/administrator/components/com_akeebabackup/restore.php'">
    <IfModule mod_headers.c>
        Header always unset Content-Security-Policy
    </IfModule>
</If>
<If "%{REQUEST_URI} == '/administrator/components/com_joomlaupdate/extract.php'">
    <IfModule mod_headers.c>
        Header always unset Content-Security-Policy
    </IfModule>
</If>
<If "%{REQUEST_URI} =~ m#^\.well\-known/#">
    <IfModule mod_headers.c>
        Header always unset Content-Security-Policy
    </IfModule>
</If>
<If "%{REQUEST_URI} =~ m#^cache/#">
    <IfModule mod_headers.c>
        Header always unset Content-Security-Policy
    </IfModule>
</If>
<If "%{REQUEST_URI} =~ m#^templates\/rt_audacity/#">
    <IfModule mod_headers.c>
        Header always unset Content-Security-Policy
    </IfModule>
</If>
<If "%{REQUEST_URI} =~ m#^images\/\*/#">
    <IfModule mod_headers.c>
        Header always unset Content-Security-Policy
    </IfModule>
</If>
<If "%{REQUEST_URI} =~ m#^plugins\/system\/bfnetwork\/bfnetwork/#">
    <IfModule mod_headers.c>
        Header always unset Content-Security-Policy
    </IfModule>
</If>
##### Advanced server protection rules exceptions also bypass the “disable client-side risky behavior” features -- END

## Disallow access to htaccess.txt, php.ini, .user.ini and configuration.php-dist
RewriteRule ^(htaccess\.txt|configuration\.php-dist|php\.ini|\.user\.ini)$ - [F]
# Disallow access to all other front-end folders
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !^/
RewriteRule .* - [F]

# Disallow access to all other front-end files
#RewriteCond %{REQUEST_FILENAME} -f
#RewriteRule !^index.php$ - [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>
## Remove Apache and PHP version signature
<IfModule mod_headers.c>
    Header always unset X-Powered-By
    Header always unset X-Content-Powered-By
</IfModule>

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

## Referrer-policy
<IfModule mod_headers.c>
    Header always set Referrer-Policy "unsafe-url"
</IfModule>
## 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`.
#
# https://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
# PHP FastCGI fix for HTTP Authorization
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
##### Joomla! core SEF Section -- BEGIN
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
##### Joomla! core SEF Section -- END

1 Answer 1

1

I believe this is a duplicate of this question, but the context given here is more exhaustive, so I think I clearly understand what the problem is.

The problem is that Joomla 3 worked in a wrong way - in essence, that link should have never worked in the first place. The reason why I'm saying this is because if you replace lymington with anything else (on Joomla 3) the link will still work, because it'll essentially ignore the "lymington" part and just know what the content should be from the article alias. Without going into details, this is a big problem from an SEO perspective, it can also cause unexpected behaviors depending on how you use the website. Joomla 4 fixed this quirky behavior by insisting that the whole link must be correct for it to work, and not just part of the link.

The solution to your problem is to have a rewrite in your URL to remove the lymington part the following way (you just need to add the below lines to your .htaccess file):

RewriteEngine on 
RewriteRule ^lymington/(.*)$ $1
3
  • Thanks @ictopus - I should have closed the previous question now I've done a bit moe digging. I tried the above rule using the URL lymington.com/lymington/126-charitable/2078-forca-fundraising but without the /lymington/ part of the URL it still throws a 404? Any further ideas?
    – Dtorr1981
    Aug 10, 2023 at 8:12
  • lymington has to be part of the rule - can you post your .htaccess here?
    – itoctopus
    Aug 10, 2023 at 8:22
  • I've just updated the question with my htacess.
    – Dtorr1981
    Aug 10, 2023 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.