It’s not really a %
. It’s %20
that’s coding for having a space in the folder name. The coding doesn’t work for many things like Apache htaccess files, that’s why we try to tell everyone never use spaces, always use lowercase letters and a -
or _
in folder names.
to get around this, you replace the space %20
with an escaped-s \s
(RegEx for space).
RewriteRule ^Limited\sEdition/prints\.html$ https://deborahgriceartist.uk/portfolio/printmaking/$ [NC,R=302,L]
Now for the rest of the htaccess file. This is code every char counts. you have somehow replaced the \.html
with |.html
on some lines. Others you left it \.html
. on the ends of the new addresses some you have the trailing /$
others you have just the/
and others you don’t have either. Some old URLs start with a //
some start with a ‘/’ and some don’t have anything.
And the second RewriteRule
RewriteRule ^page|.html$ https://deborahgriceartist.uk/ [NC,R=302,L]
Not sure what that one is doing. Not sure what the old URL was? And it won’t match anything because of the |.html
instead of the \.html
.
So let’s explain a little here what this means. ReWriteRule’s use Regular Expressions (RegEx). So all these special characters have meanings.
- The
^
say the string they match us against starts with the following pattern.
- The
\
is an escape character, meaning what directly follows is a character that normally has special meaning to RegEx and to ignore the special meaning and treat that char as is like the .
- The ‘$’ says the string they match us against ends with the preceding pattern
There are books of information on RegEx, but each character means something.
So I went in and cleaned up the Rewrite rules. I think I cought most of the errors. I left them 302’s so I’d just replace the entire htaccess file with this:
# Disable directory browsing (security)
Options -Indexes
# Force HTTPS and Remove WWW (this line is a comment)
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
# 404 Error page assignment
ErrorDocument 404 /Error/404.html
# set page redirects
RewriteRule ^painting/OIls\.html$ https://deborahgriceartist.uk/paintings/? [NC,R=302,L]
RewriteRule ^about/biography\.html$ https://deborahgriceartist.uk/about/? [NC,R=302,L]
RewriteRule ^Limited\sEdition/prints\.html$ https://deborahgriceartist.uk/portfolio/printmaking/ [NC,R=302,L]
RewriteRule ^paintings/Paintings/miniatures\.html$ https://deborahgriceartist.uk/portfolio/printmaking/ [NC,R=302,L]
RewriteRule ^page/biography\.html$ https://deborahgriceartist.uk/cv/? [R=302,L]
RewriteRule ^paintings/paintings\.html$ https://deborahgriceartist.uk/portfolio/paintings/? [R=302,L]
RewriteRule ^oilpaintings/oncanvas\.html$ https://deborahgriceartist.uk/portfolio/paintings/? [NC,R=302,L]
RewriteRule ^subscribe/form\.html$ https://deborahgriceartist.uk/contact/? [NC,R=302,L]
RewriteRule ^contact/hello\.html$ https://deborahgriceartist.uk/contact/? [NC,R=302,L]
RewriteRule ^about/biography\.html$ https://deborahgriceartist.uk/about/? [NC,R=302,L]
RewriteRule ^onpaper/mixedmedia\.html$ https://deborahgriceartist.uk/portfolio/drawings/? [NC,R=302,L]
RewriteRule ^drawings/drawing\.html$ https://deborahgriceartist.uk/portfolio/drawings/? [NC,R=302,L]
RewriteRule ^painting/drawingsonpaper/mixedmedia\.html$ https://deborahgriceartist.uk/portfolio/drawings/? [NC,R=302,L]
RewriteRule ^contact/hello\.php$ https://deborahgriceartist.uk/contact/? [R=302,L]
Then try testing again. if you are happy with the test results then Carefully change the 302’s to 301’s.