1

I've just added a load of 301 Redirects and they all work apart from those that include a PHP extension. For example, /gallery/ redirects fine and so does /brochure.pdf but /sitemap.php or any other URL ending in .php won't redirect.

I'm assuming it must be server related, but not sure where to look.

I'm using Ubuntu 20.04, PHP 7.4, NGINX 1.18.0

Can anyone point me in the right direction?

.htaccess contents

# BEGIN iThemes Security - Do not modify or remove this line
# iThemes Security Config Details: 2
    # Pass through Authorization header.
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{HTTP:Authorization} ^(.*)
        RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
    </IfModule>
# END iThemes Security - Do not modify or remove this line

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
4
  • Do you use a .htaccess file?
    – Jos
    Nov 12, 2020 at 9:22
  • Yes, contents just added. Nov 12, 2020 at 9:31
  • I'm using a WordPress redirection plugin, but even adding the following into the .htaccess file doesn't work. Redirect 301 /sitemap.php mywebaddress.com Nov 12, 2020 at 9:33
  • I've recreated the missing files and placed the following within them... header("Location: mywebaddress.com", true, 301); exit(); Nov 12, 2020 at 9:57

0

You must log in to answer this question.

Browse other questions tagged .