.htaccess 301 redirection not working?

I have a static page of the form page1.html in my root directory and another index.php page also in the root directory. What I'm trying to do is move all the old inbound links to point to the Wordpress directory. I got the main domain for redirection via .htaccess and index.php, which I found on my hosting provider support site (i.e. Abc.com is now redirected to my installation folder for Wordpress).

Now the problem is that all pages that have been directly linked or indexed are still showing up. For example, abc.com/page1.html is still displayed. I tried using the following .htaccess code to redirect to a new site:

redirect 301 /page1.html abc.com/index.php

The above code should be correct from my understanding, since my index.php loads Wordpress data (the same method that is used for abc.com redirection to work correctly), but for some reason the redirection does not occur.

Here is a general layout of my .htaccess file.

# BEGIN WordPress redirect
# This part is for the abc.com -> wordpress folder redirect.
# Code taken strait from my hosting provider help tutorial.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /WordpressInstallation/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /WordpressInstallation/index.php [L]
</IfModule>

# Problem code below
# Static page redirects
redirect 301 /page1.html /index.php
redirect 301 /page2.html /index.php
.
.
.

Any ideas on what I'm doing wrong or how can I achieve the result I'm looking for?

Edit:

This may be optional information, but page1.html, page2.html, etc. are located in the root directory with the .htaccess file, and the wordpress installation is located in the folder named wordpressInstallation in the root directory. I just thought that I would clarify that if the question had not made this clear.

/
---wordpressInstallation
------Wordpress files (head.php, index.php, style.css etc.)
---page1.html
---page2.html
.
.
.
---index.php
---.htaccess
.
.
.
+4
source share
1 answer
  • mod_rewrite mod_alias.
  • WP .

DocumentRoot/.htaccess ( wordpress):

RewriteEngine On

RewriteRule ^(page1|page2)\.html?$ /wordpressInstallation/ [L,NC,R=301]

Redirect Wordpress.htaccess.

+2

All Articles