I have a wordpress installed in a subfolder called blog/
I have two htaccess files, one in the root directory, one in blog folder, generated by wordpress.
The first htaccess in root directory:
# BEGIN
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/(blog/.*)$
<IfModule mod_rewrite.c>
Redirect 301 "/old_page" "http://example.com/new-page"
...
<IfModule>
# END
The second htaccess in blog folder:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
<IfModule>
# END WordPress
My issue is when I navigate to http://example.com/blog/, I’m redirected to a link like that:
http://example.com/index.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlblog/
2
Answers
I have checked your Htaccess code used for the subfolder URL, it will work fine and I have modified the root directory Htaccess code for redirection.
Please try to below code for this.
SubFolder Htaccess code
You can use the below code for the old URL to new URL: