questions

Redirect all the pages to the single page using htaccess?

Rate this post

I am using WordPress and I have to redirect all the pages to the index.html page (I created in the root folder for temporary).

I tried the below code but it’s redirecting only the home page.

Redirect 301 "index.html" "https://www.examle.com"

I tried

RewriteRule ^(.*)$ https://www.examle.com/$1 [R=permanent,L] //getting error(The page isn’t redirecting properly)

I tried the below code

RewriteCond %{REQUEST_URI} !/index.html$ 
RewriteCond %{REMOTE_HOST} !^00.00.00.00   //my ip
RewriteRule $ /index.html [R=302,L]

Any other solution to redirect all pages to index.html? I have more than 50 pages on my website. I want to redirect all on the index.html

 

✔️Solution:

You can overwrite your existing .htaccess file content with this. Please note that this code assumes that your wordpress is installed on the root directory.

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index.html$
RewriteRule . /index.html [R=302,L]

Leave a Reply

Your email address will not be published.

Back to top button