I'm trying to redirect an HTML page to a WordPress page which has no extension. The result of redirecting example.com/fa/home.html
to example.com/fa/
is a 404 page not found
. As you can see they're both in a sub-directory.
I've tried many approaches, whether manually or through cPanel to redirect those URLs. Note that I'm using a Nginx web server.
When I try to redirect another URL like example.com/en/home.html
which is NOT in the /fa
directory, it will successfully redirect. I have an .htaccess file in the root folder and one in the /fa
directory. I deleted everything in the .htaccess file in the /fa
directory and only left the default index page rule, but still no luck.
The .htaccess
code in the root directory is:
RewriteEngine on
DirectoryIndex Portal.html
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mscaspian.com$
RewriteRule (.*) http://www.mscaspian.com/$1 [R=301,L]
RewriteCond %{HTTP_REFERER} !^http://mscaspian.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://mscaspian.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mscaspian.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mscaspian.com$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ http://www.mscaspian.com [R,NC]
ErrorDocument 404 /404.html
And the code in the /fa
directory is:
DirectoryIndex index.html index.htm index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /fa/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /fa/index.php [L]